TCP/IP Programming Manual

int error, socket;
struct sockaddr *address_ptr;
int address_len;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := bind (socket, address_ptr, address_len);
error := bind_nw (socket, address_ptr, address_len, tag);
INT(32) error, socket;
INT .EXT address_ptr(sockaddr_in);
INT(32) address_len;
INT(32) tag;
error
return value; if the call is successful, a zero is returned. If the call is not successful, —1 is
returned. If the call failed, the external variable errno is set as indicated in Errors (page 99).
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
address_ptr
input value; points to the address-port number combination based in the structure sockaddr,
sockaddr_in6, or sockaddr_storage, to which the socket is to be bound.
If the address in the sin_addr field of the structure is INADDR_ANY, connections are accepted
from hosts on any network. If the port number in the sin_port field of the structure is zero,
the next available port is assigned. Port numbers 0 to 1023 are reserved for use by predefined
services, such as TELNET. If the port number is in the range 0 through 1023 (known as reserved
ports), the process access ID of the requesting application must be in the SUPER group (user
ID 255,nnn).
For NonStop TCP/IPv6, if the address in the sin6_addr field of the structure is in6addr_any,
connections are accepted from hosts on any network. If the port number in the sin6_port
field of the structure is zero, the next available port is assigned. Port numbers 0 to 1023 are
reserved for use by predefined services, such as TELNET. If the port number is in the range 0
through 1023 (known as reserved ports), the process access ID of the requesting application
must be in the SUPER group (user ID 255,nnn).
address_len
input value; address_len is maintained only for compatibility and should be a value indicating
the size in bytes of the structure (the remote address and port number) pointed to by
address_ptr.
tag
input value; the tag parameter to be used for the nowait operation initiated by bind_nw.
Errors
If an error occurs, the external variable errno is set to one of the following values:
The specified IP address and port number was not available on the local host.EADDRNOTAVAIL
The specified IP address and port number was already in use.EADDRINUSE
bind, bind_nw 99