Socket addresses

In practice "socket" usually refers to a socket in an Internet Protocol (IP) network (where sockets may be called Internet sockets), in particular for the Transmission Control Protocol (TCP), which is a protocol for one-to-one connections. In this context, sockets are assumed to be associated with a specific socket address, namely the IP address and a port number for the local node, and there is a corresponding socket address at the foreign node (other node), which itself has an associated socket, used by the foreign process. Associating a socket with a socket address is called binding.

Note that while a local process can communicate with a foreign process by sending or receiving data to or from a foreign socket address, it does not have access to the foreign socketitself, nor can it use the foreign socket descriptor, as these are both internal to the foreign node. For example, in a connection between 10.20.30.40:4444 and 50.60.70.80:8888 (local IP address:local port, foreign IP address:foreign port), there will also be an associated socket at each end, corresponding to the internal representation of the connection by the protocol stack on that node, which are referred to locally by numerical socket descriptors, say 317 at one side and 922 at the other. A process on node 10.20.30.40 can request to communicate with node 50.60.70.80 on port 8888 (request that the protocol stack create a socket to communicate with that destination), and once it has created a socket and received a socket descriptor (317), it can communicate via this socket by using the descriptor (317): the protocol stack will then forward data to and from node 50.60.70.80 on port 8888. However, a process on node 10.20.30.40 cannot request to communicate with "socket 922" or "socket 922 on node 50.60.70.80": these are meaningless numbers to the protocol stack on node 10.20.30.40.

 

1.                  Process to process delivery (transport layer communication) needs two identifiers, one is IP address and the other is port number at each end to make a connection.

2.                  Socket address is the combinations of IP address and port number as shown in the figure.

1.                  The client socket address defines the client process uniquely whereas the server socket address defines the server process uniquely.

2.                  A transport layer protocol requires the client socket address as well as the server socket address. These two addresses contain four pieces.

3.                  These four pieces go into the IP header and the transport layer protocol header.

4.                  The IP header contains the IP addresses while the UDP and TCP headers contain the port numbers.