Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

Table 12 Sockets Header Filenames (continued)
OSS Header Filename (in /usr/include)Guardian Header Filename
(in $SYSTEM.ZTCPIP)
<netdb.h>NETDBH
<netinet/route.h>ROUTEH
<sys/socket.h>SOCKETH
<sys/types.h>TYPESH
In the Guardian environment, the LISTNER process must be used to activate servers. The OSS
environment supports the use of inetd to spawn server processes.
LISTNER cannot directly activate OSS programs. To activate an application in the OSS
environment the same way that LISTNER activates Guardian programs, either start the
application using inetd or write a small program to interface with the LISTNER process. The
latter program would start the real application in the OSS environment, passing the port
number and IP address from LISTNER to the OSS application. For further information on
LISTNER, refer to the TCP/IP Programming Manual or the IPX/SPX Programming Manual. For
more information on inetd, refer to Starting an “Starting an OSS Server Process (page 106).
The most important difference between OSS sockets and Guardian sockets is the way in which
socket input/output is performed.
When a Guardian sockets application performs waited I/O, control is not returned to the
application until a socket I/O call completes. This behavior is the same as that of an OSS
sockets application using blocking sockets.
If a Guardian sockets application uses nowait I/O for sockets, you must modify it to use OSS
sockets functions.
Guardian concurrent processing uses function calls that are nowait analogs of standard sockets
library calls; these analogous functions include socket_nw(), recv_nw(), and send_nw().
To perform nowait I/O, a Guardian application:
Creates a socket using socket_nw()
Performs reads or writes with the other nowait functions (each input/output operation
requires a separate preallocated buffer)
Tests Guardian file numbers for I/O completion
You have three choices when migrating a Guardian nowait I/O application to use OSS
sockets:
You can rewrite the application to use only blocking sockets. This option is usually
not a good choice for applications that need to handle multiple requests concurrently.
182 Porting or Migrating Sockets Applications