Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Porting or Migrating Sockets Applications
Open System Services Porting Guide520573-006
11-4
Porting Guardian Sockets Applications to the OSS
Environment
A BSD sockets application using nonblocking socket input/output can be easily
ported to the OSS environment with one minor change. In the UNIX environment, a
socket is marked as nonblocking by calling the fcntl() function for the socket
descriptor and using the function’s F_SETFL command to set the FNDELAY flag.
The OSS environment does not support the FNDELAY flag; instead, an OSS
application calls fcntl() and sets the O_NONBLOCK flag to mark a socket as
nonblocking.
inetd activated services
Applications using inetd activated services can generally be ported to the OSS
environment with minimal changes, provided the General Considerations on
page 11-1 are observed. For more information, refer to Starting an OSS Server
Process on page 6-26.
Porting Guardian Sockets Applications to the
OSS Environment
The following subsections discuss:
General Considerations on page 11-4
Differences Between OSS Sockets and Guardian Sockets on page 11-5
Compiling Native and TNS OSS Programs on page 11-7
Additional considerations and sample programs can be found in the Open System
Services Programmers Guide.
General Considerations
The following is a list of general considerations for porting a sockets program from the
Guardian environment to the OSS environment:
Guardian programs can use 32-bit or 16-bit integers. OSS C programs use only
wide memory model 32-bit integers.
Most sockets routine arguments are of type int. If your program used the small
memory or large memory model in the Guardian environment, where the size of
the sockets library int is 16 bits, the program needs to be modified to use 32 bits;
int arguments such as socket_number and length are 32 bits in the OSS
environment instead of 16 bits. If you have declared these arguments as int
throughout your program, no changes to them should be required. If you have
used any other C declaration type, such as short for a sockets routine argument,
then your program must be changed accordingly.
For more information on converting programs to use the 32-bit data model, refer to
the C/C++ Programmer’s Guide.