Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bind(2) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

connect(2)

getsockname(2)

listen(2)

socket(2)

bind(2)

NAME

bind − bind a name to a socket

SYNTAX

#include <sys/types.h>
#include <sys/socket.h>

int bind(s, name, namelen)
int s, namelen;
struct sockaddr *name;

DESCRIPTION

The bind system call assigns a name to an unnamed socket.  When a socket is created with the socket call, it exists in a name space (address family) but has no name assigned. 

Binding a name in the UNIX domain creates a socket in the file system which must be deleted when it is no longer needed by using the unlink call.  The file created is a side-effect of the current implementation and will not be created in future versions of the UNIX IPC domain. 

The rules used in name binding vary between communication domains.  For detailed information, see the appropriate manual entries in section 4. 

RETURN VALUE

If unsuccessful, returns a −1, and the global variable errno indicates the error code. 

DIAGNOSTICS

The bind call will fail if:

[EBADF] The specified s is not a valid descriptor. 

[ENOTSOCK] The specified 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. 

[EACCES] The requested address is protected, and the current user has inadequate permission to access it. 

[EFAULT] The specified name is not in a valid part of the user address space. 

SEE ALSO

connect(2), getsockname(2), listen(2), socket(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026