TCP/IP Programming Manual
Generally, at least one end of the session requests a port number that is guaranteed to be unique.
The client program normally requests the unique port number, because the server typically uses a
well-known port.
Network and Host Order
In the descriptions of some of the support routines in the socket library, this manual refers to IP
addresses or port numbers as being in network order or in host order. These terms refer to the
routines the order in which the octets are stored in arguments passed to or returned by the routines.
On NonStop operating systems, network order is the same as host order.
The Internet standard for the transmission of 32-bit integers specifies that the most-significant octet
should appear first. However, not all hosts store integers in the same way. Thus, copying octets
directly from one host to another can change the value of a number. The Internet standard specifies
that sending hosts must translate from their local integer representation (local order) to network
order (most-significant octet first). Receiving hosts are required to translate from network order to
local order.
Programming Using the Guardian Sockets Interface
This subsection provides guidelines for programming to the Guardian sockets library, including:
• Porting Considerations
• Nowait I/O (page 32)
• Differences Between UNIX and NonStop Server Implementations (page 33)
• NonStop TCP/IP, Parallel Library TCP/IP, and NonStop TCP/IPv6 Basic Steps (page 35)
Porting Considerations
The socket library routines are based on the 4.3 BSD implementation of the UNIX operating system.
However, there are some differences, mostly resulting from differences between the NonStop
operating system and the UNIX environment. Therefore, some parts of your programs need to
change if you are porting them from the 4.3 BSD UNIX operating system or from some other TCP/IP
implementation.
Nowait I/O
Nowait I/O in the NonStop operating-system environment is similar to nonblocking I/O in UNIX,
but there are important differences. First, nowait I/O can be performed only over a socket that
was created for nowait I/O (with a call to the socket_nw function). Once a socket is created, it
cannot be switched from one mode to the other.
The following nonstandard socket calls are available for nowait I/O:
shutdown_nwgetsockopt_nwaccept_nw
socket_nwrecv_nwaccept_nw1
t_recvfrom_nwrecvfrom_nwaccept_nw2
t_sendto_nwsend_nw*bind_nw
t_sendto_nw64_send_nw2connect_nw
sendto_nw64_sendto_nwgetpeername_nw
sendto_nw2_64_sendto_nw64_getsockname_nw
recv_nw64_setsockopt_nwrecvfrom_nw64_
t_recvfrom_nw64_send_nw2_64_
In most cases, the parameters for these calls are identical to those of the corresponding waited
calls, with the addition of extra parameters for NonStop operating system requirements. The
32 Introduction to Programming to the Guardian Sockets Library