Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Assigning a name to a socket

&pagelevel(3)&pagelevel

A socket created with s=socket() initially has no name. The socket must therefore be assigned a name, i.e. a local address, according to its address family. Processes can only address the socket and receive messages over it after this is done. You bind a name to the socket, i.e. you assign the socket a local address, with the bind() function.

You call bind() as follows:

bind(s, name, namelen);

The structure of the name name, which is assigned to socket s, differs according to the address family (AF_INET, AF_INET6 or AF_UNIX).

namelen contains the length of the data structure that describes the name.