A socket is created with the socket() call. This call creates a socket of a specified:
An application can use the bind() call to associate a local name (usually a network address) with a socket. The form and meaning of socket addresses are dependent on the protocol family in which the socket is created. The socket name is specified by a sockaddr structure.
The bind() call is optional under some circumstances: the connect() call and any of the data transmission calls (for example, send()) will automatically associate the local name to the socket if bind() hasn't been called.