TCP/IP Programming Manual
Types of Service
Depending on the type of communications service required, your application uses one or more of
the following protocols:
• The Transmission Control Protocol (TCP) provides reliable end-to-end data transfer. TCP is a
stream-oriented protocol that has no concept of packet boundaries. TCP guarantees that all
data sent is received and that the data arrives in the same order in which it was sent.
• The User Datagram Protocol (UDP) provides unreliable datagram service. The integrity of the
packets sent is maintained; that is, when a packet is received, it matches exactly what was
sent. However, neither the delivery of the datagrams nor the order in which the datagrams
are received is guaranteed.
• The Internet Protocol (IP) allows data to be transferred between heterogeneous networks. It
also services various host-to-host protocols. IP provides many capabilities at the network level
and is the foundation of the NonStop TCP/IP subsystems. TCP and UDP use the Internet Protocol
(IP). In addition, applications can provide their own Transport Layer protocols, built directly
on IP.
The Socket Library Routines
All NonStop TCP/IP subsystems provide a socket interface that uses the HP NonStop operating
system file-system procedures for interprocess communication and that provides socket library
routines for the integration of UNIX and NonStop systems. You can use the socket library routines
to access the socket interface programmatically.
A socket is an end point for communication. An application process calls a socket routine to request
that the TCP/IP subsystem create a socket when needed and specify the type of service desired.
Applications can request TCP and UDP sockets, as well as raw sockets, for direct access to the IP.
(A raw socket allows direct access to a lower-level protocol.) The TCP/IP subsystem returns a socket
number, which the application uses to reference the new socket.
After creating a socket, the application optionally binds the socket to a specific local address and
port, and sends or receives data on the socket. When the transfer is complete, the application can
shut down the socket and close it.
The NonStop server socket interface is modeled after the Berkeley Software Distribution (BSD)
sockets interface to allow you to port existing UNIX TCP/IP applications to run on a NonStop
system. For a description of the available socket-library routines, see Chapter 4 (page 81). For a
summary of the differences between the NonStop TCP/IP socket interface and the 4.3 BSD UNIX
interface, see Programming Using the Guardian Sockets Interface.
Although the NonStop server socket-library routines are based on the sockets programmatic-interface
primitives in the 4.3 BSD release of the UNIX operating system, the NonStop server routines do
not map exactly to the 4.3 BSD release function calls or functionality. The NonStop server routines
include extensions to adapt the Berkeley sockets interface to HP fault-tolerant, operating-system
features such as nowait I/O.
Beginning with the D30 RVU of NonStop TCP/IP, the socket library supports HP fault-tolerant
applications (process pairs) written in either the C or TAL languages. This support is provided by
two socket-library routines that permit the opening of sockets by a backup application. These
routines are described in Chapter 4 (page 81) of this manual.
Servers and Clients
The terms server and client are used in the NonStop TCP/IP subsystems as they are customarily
used in TCP/IP documentation. A server is a process that offers a service that can be used over
the network; a server accepts requests, performs the specified services, and returns the results to
requesters. A client is one of the processes that sends requests to the server and waits for it to
respond. The client-server model is the same model known in other HP documentation as the
TCP/IP Programming Fundamentals 25