Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

connect(2)

listen(2)

socket(2)

getsockname(2)

inet(7F)

BIND(2)  —  Series 300 and 800 Only

NAME

bind − bind an address to a socket

SYNOPSIS

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

bind(s, addr, addrlen)
int s;
struct sockaddr *addr;
int addrlen;

DESCRIPTION

Bind assigns an address to an unbound socket.  When a socket is created with socket(2), it exists in an address space (address family) but has no address assigned. Bind causes the socket whose descriptor is s to become bound to the address specified in the socket address structure pointed to by addr. Addrlen must specify the size of the address structure. 

The rules used in address binding vary between communication domains.  Consult the manual entries in section 7 for detailed information (for example, inet(7F)).

RETURN VALUE

If the bind is successful, a 0 value is returned.  If it fails, −1 is returned and an error code is stored in errno. 

DIAGNOSTICS

The bind call fails if:

[EBADF] s is not a valid descriptor. 

[ENOTSOCK] s is not a socket. 

[EADDRNOTAVAIL] The specified address is bad or not available from the local machine. 

[EADDRINUSE] The specified address is already in use. 

[EINVAL] The socket is already bound to an address, the socket has been shut down, or addrlen is a bad value. 

[EAFNOSUPPORT] Requested address does not match the address family of this socket. 

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

[EFAULT] The addr parameter is not a valid pointer. 

[EOPNOTSUPP] The socket whose descriptor is s is of a type which does not support address binding. 

[ENOBUFS] Insufficient buffer memory is available.  The bind can not complete. 

DEPENDENCIES

Implemented on the Series 300 and 800 only. 

AUTHOR

UCB (University of California at Berkeley)

SEE ALSO

connect(2), listen(2), socket(2), getsockname(2), inet(7F). 

Hewlett-Packard Company  —  May 11, 2021

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