BIND(2) Series 300 Only BIND(2)
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;
HP-UX COMPATIBILITY
Level: HP-UX/NON-STANDARD
Origin: UCB
Remarks: Implemented on the Series 300 only.
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 4 for
detailed information (e.g., inet(4F)).
The bind call will fail 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
Hewlett-Packard - 1 - (printed 7/16/86)
BIND(2) Series 300 Only BIND(2)
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.
[ENET] A hardware error is detected on the
interface card.
RETURN VALUE
If 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.
SEE ALSO
connect(2), listen(2), socket(2), getsockname(2), inet(4F).
Hewlett-Packard - 2 - (printed 7/16/86)