bind(2dn)
NAME
bind − bind a name to a socket
SYNTAX
#include <sys/types.h>
#include <sys/socket.h>
#include <netdnet/dn.h>
bind (s,name,namelen)
int s;
struct sockaddr_dn *name;
int namelen;
ARGUMENTS
Input Arguments
s Specifies a descriptor for a socket that has been returned by the socket call.
name Specifies the address of a structure of the type sockaddr_dn.
namelen Specifies the size of the address of the structure sockaddr_dn. The following data fields are filled in by this call:
sdn_family Specifies the communications domain as AF_DECnet.
sdn_objnum Specifies the DECnet object number to which you are binding. If the object number is 0, the DECnet object name, sdn_objname, is used.
sdn_objnamel Specifies the size of the object name to which you are binding. This argument is used only when the DECnet object number, sdn_objnum, is 0.
sdn_objname Specifies the name of the source network program. This argument is used only when the DECnet object number, sdn_objnum, is 0.
DESCRIPTION
The bind call assigns a name to a socket. When a socket is created with the socket call, it exists in a name space (address family) but has no assigned name. The bind call requests that a specific name be assigned to the socket.
The DECnet object numbers 1-127 are reserved only for sockets that are set up to receive connections in programs running as superuser.
RETURN VALUE
If the bind call is successful, a value of 0 is returned. If the call is unsuccessful, a value of −1 is returned and the external variable errno contains error detail.
DIAGNOSTICS
[EBADF] The s argument is not a valid descriptor.
[EADDRINUSE] The specified name is already bound on the local machine.
[EINVAL] The namelen argument is not the size of sockaddr_dn, or sdn_objnamel is not in the range of 0 to 16.
[EACCESS] The requested address is protected, and the current user has inadequate permission to access the address.
[EFAULT] The name argument is not located in a valid part of the user’s address space.
[EAFNOSUPPORT] The sdn_family is not AF_DECnet.
RESTRICTIONS
Currently, bound names are ignored for sockets that are set up to initiate connections in all programs except programs running as superuser.