| manpages.info - online man pages | ![]() |
|||
|
bind (2) Table of Contents
Namebind - bind a name to a socket
Synopsis
#include <sys/types.h>
int
DescriptionBind() assigns a name to an unnamed socket. When a socket is created with socket(2) it exists in a name space (address family) but has no name assigned. Bind() requests that name be assigned to the socket.
NotesBinding a name in the UNIX domain creates a socket in the file system that must be deleted by the caller when it is no longer needed (using unlink(2) ).
The rules used in name binding vary between communication domains. Consult the manual entries in section 4 for detailed information.
Return ValuesIf the bind is successful, a 0 value is returned. A return value of -1 indicates an error, which is further specified in the global errno.
ErrorsThe bind() call will fail if:
The following errors are specific to binding names in the UNIX domain.
See Alsoconnect(2) , listen(2) , socket(2) , getsockname(2)
HistoryThe bind() function call appeared in 4.2BSD.
|