Socket Address Data Structures
The socket data structure defines the socket. During a socket subroutine, the system dynamically creates the socket data structure.
The socket address is specified by a data structure that is defined in a header file. See the sockaddr Structure figure (Figure 1) for an illustration of this data structure.

The /usr/include/sys/socket.h file contains the sockaddr structure. The contents of the sa_data structure depend on the protocol in use.
The types of socket-address data structures are as follows:
Item | Description |
---|---|
struct sockaddr_in | Defines sockets used for machine-to-machine communication across a network and interprocess communication (IPC). The /usr/include/netinet/in.h file contains the sockaddr_in structure. |
struct sockaddr_un | Defines UNIX domain sockets used for local IPC only. These sockets require complete path name specification and do not traverse networks. The /usr/include/sys/un.h file contains the sockaddr_un structure. |
struct sockaddr_ndd | Defines the operating system NDD sockets used for machine-to-machine communication across a physical network. The /usr/include/sys/ndd_var.h file contains the sockaddr_ndd structure. Depending upon socket types and protocol, other header files may need to be included. |