Creating and Naming Sockets

This section explains the procedure of creating and naming sockets.

A socket is created with the socket subroutine. This subroutine creates a socket of a specified domain, type, and protocol. Sockets have different qualities depending on these specifications. A communication domain indicates the protocol families to be used with the created socket. The socket type defines its communication properties such as reliability, ordering, and prevention of duplication of messages. Some protocol families have multiple protocols that support one type of service. To supply a protocol in the creation of a socket, the programmer must understand the protocol family well enough to know the type of service each protocol supplies.

An application can bind a name to a socket. The socket names used by most applications are readable strings. However, the name for a socket that is used within a communication domain is usually a low-level address. The form and meaning of socket addresses are dependent on the communication domain in which the socket is created. The socket name is specified by a sockaddr structure (see Socket Address Data Structures).