bind(SSC) 6 January 1993 bind(SSC) Name bind - bind a name to a socket Syntax #include <sys/types.h> #include <sys/socket.h> int bind (s, name, namelen) int s; struct sockaddr *name; int namelen; Description bind assigns a name to an unnamed socket. When a socket is created with socket(SSC), it exists in a name space (address family) but has no name assigned. bind requests that name be assigned to the socket. Notes The rules used in name binding vary between ``communication domains''. (See protocols(SFF) for more information.) Consult the manual entries in the ADMP and SFF sections for detailed information. Return value A return value of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and in this case an error code is stored in the global variable errno. Errors The bind call will fail if: [EBADF] s is not a valid descriptor. [ENOTSOCK] s is not a socket. [EADDRNOTAVAIL] The specified address is not available from the local machine. [EADDRINUSE] The specified address is already in use. [EINVAL] The socket is already bound to an address. [EACCESS] The requested address is protected, and the current user has inadequate permission to access it. [EFAULT] The name parameter is not in a valid part of the user address space. Note Currently, only the Internet address family is supported. See also Intro(SSC), connect(SSC), getsockname(SSC), listen(SSC), socket(SSC), inet(ADMP) and intro(ADMP).