TCP/IP Programming Manual

The specified socket was already bound to an address, or the address_len was incorrect.EINVAL
The specified address cannot be assigned to a nonprivileged user.EACCES
Usage Guidelines
Use bind on a socket created for waited operations, or bind_nw on a socket created for
nowait operations. The operation initiated by bind_nw must be completed with a call to the
AWAITIOX procedure.
NOTE: The socket goes into a TCP LISTEN state after the application completes a bind on
an IP address and port. There is a possibility that TCP/IP can receive a connection on that
socket if a rogue client tries to connect to that IP address and port.
Multiple sockets created by different processes can be bound to the same UDP port. When a
broadcast message arrives on the UDP port, only one process is notified. TCP/IP determines
which process to notify based on the network address portion of the Internet address. If the
network address of a socket is the same as the network address of the broadcast message,
the process that created and bound the socket is notified. For example, assume these sockets
A, B, and C are created by different processes and are bound to port 67 using the following
Internet addresses:
Socket A 130.252.12.8
Socket B 130.252.10.8
Socket C 10.5.0.9
A UDP broadcast message addressed to 130.252.10.255 (port 67) arrives on the socket
bound to port 67 with Internet address 130.252.10.8. The process that created socket B is
notified because the network address of the socket matches the network address of the
broadcast message. (In the Berkeley sockets interface, the socket most recently bound to the
port is notified.)
Only one socket can be bound to a particular combination of Internet address and port number.
UDP Port Considerations for Parallel Library TCP/IP and NonStop TCP/IPv6. If a process
maintains a context for its messages, the process should not use round robin on shared UDP
ports.
The processes sharing the UDP port should not maintain a context for previous messages
because there is no guarantee that a sequence of messages is delivered to the same socket
if the port is shared. In fact, with round-robin enabled, a sequence of messages is distributed
to each of the port-sharing sockets, in turn.
For example, TFTP server assumes that all packets from a given source are directed to it (the
TFTP server process). This assumption about the source is what is meant by maintaining a
context.” Because TFTP server makes that assumption about packets from a given source,
that is, maintains that “message context,” it must be the only TFTP server process on that UDP
port. If another TFTP server is sharing the UDP port, packets from the same source could go
to two different TFTP server processes resulting in one of the TFTP servers missing some of the
packets destined for it.
For applications that must maintain a context across multiple messages received (such as TFTP
server and WANBOOT), if you want multiple instances running in parallel, you can circumvent
the problem introduced by round robin by changing the application to bind to the SUBNET
IP address rather than to INADDR_ANY or IN6ADDR_ANY. Binding to the IP address allows
one instance of the application for each SUBNET to be supported by Parallel Library TCP/IP
and NonStop TCP/IPv6 with sharing of the same port number. NonStop TCP/IPv6 and NonStop
TCP/IP then distributes incoming packets that came in from one SUBNET only to the application
that bound to that SUBNET. This circumvents the problem introduced by round-robin distribution
of incoming packets among sockets sharing the same port.
100 Library Routines