When I'm looping through files and coming up with dynamically created Ansible playbooks and stuff like that, I've quite frequently had to work with a single variable that contains the IP and port of something.

Can I refer this as a "socket" or does that name always refer to a handle?

Is it better just to refer to the thing as $ip_and_port or $address_and_port or $host_and_port?

  • Answered, but this is probably a better fit for networking.so. – svidgen Mar 3 '16 at 22:44
  • 1
    Also, hi Peter! – svidgen Mar 3 '16 at 22:44
  • 1
    You could call it an endpoint. – CodesInChaos Mar 3 '16 at 22:59
  • 1
    They are of type "struct sockaddr" or more specifically "sockaddr_in" for ipv4 and "sockaddr_in6" for ipv6. So, yes, socket address. – imel96 Mar 4 '16 at 0:50

You could call it an address generically, or a socket address.

From Wikipedia, "A socket address is the combination of an IP address and a port number."

| improve this answer | |

IP is actually a transport layer protocol. It assigns a unique address to your system which is referred to as IP address.

Host is a machine which provides you some services.

Port is like a door through which your system communicates to outer world.

Socket is the interface between your system and network. Just like an electrical switch. This is where your network ends and your system begins physically.

| improve this answer | |
  • 3
    IP is a network protocol, example transport protocol would be tcp/udp. – imel96 Mar 4 '16 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.