VMS Help
TCPIP Services, Programming Interfaces, Sockets API, bind()
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Binds a name to a socket.
The $QIO equivalent is the IO$_SETMODE function with the p3
argument.
Format
#include <types.h>
#include <socket.h>
int bind ( int s, struct sockaddr *name, int namelen );
s
A socket descriptor created with the socket() function.
name
Address of a structure used to assign a name to the socket in the
format specific to the family (AF_INET) socket address.
namelen
The size, in bytes, of the structure pointed to by name.
This function assigns a port number and IP address to an unnamed
socket. When a socket is created with the socket() function, it
exists in a name space (address family) but has no name assigned.
The bind() function requests that a name be assigned to the
socket.
Related Functions
See also connect(), getsockname(), listen(), and socket().
0 Successful completion.
-1 Error; errno is set to indicate the error.
EACCESS The requested address is protected, and the
current user has inadequate permission to
access it.
EADDRINUSE The specified internet address and ports are
already in use.
EADDRNOTAVAIL The specified address is not available from
the local machine.
EAFNOSUPPORT The specified address is invalid for the
address family of the specified socket.
EBADF The socket descriptor is invalid.
EDESTADDRREQ The address argument is a null pointer.
EFAULT The name argument is not a valid part of the
user address space.
EINVAL The socket is already bound to an address and
the protocol does not support binding to a new
address, the socket has been shut down, or the
length or the namelen argument is invalid for
the address family.
EISCONN The socket is already connected.
EISDIR The address argument is a null pointer.
ENOBUFS The system has insufficient resources to
complete the call.
ENOTSOCK The socket descriptor is invalid.
EOPNOTSUPP The socket type of the specified socket does
not support binding to an address.
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.