Socket Addresses
Sockets can be named with an address so that processes can connect to them. The socket layer treats an address as an opaque object. Applications supply and receive addresses as tagged, variable-length byte strings.
Addresses always reside in a memory buffer (mbuf) on entry to the socket layer. A data structure called a sockaddr (see Socket Address Data Structures) can be used as a template for referring to the identifying tag of each socket address.
Each address-family implementation includes subroutines for address family-specific operations. When addresses must be manipulated (for example, to compare them for equality) a pointer to the address (a sockaddr structure) is used to extract the address family tag. This tag is then used to identify the subroutine to invoke the desired operation.