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

/nonnative/usr/c89 -o nnsock nnsock.c -l inet -l c
-D _XOPEN_SOURCE_EXTENDED = 1 -D _TANDEM_SOURCE
See the C/C++ Programmer’s Guide and the nld Manual, the ld Manual, or the eld Manual for
more information on compiling and linking native C and C++ programs.
Interoperability of OSS and Guardian Sockets in an OSS Application
An OSS sockets application might contain program modules that call Guardian sockets functions
as well as program modules that call OSS sockets functions, but only one type of sockets functions
(OSS or Guardian) can be used in a given module.
To compile an OSS application module that contains OSS sockets calls:
Define _XOPEN_SOURCE_EXTENDED as 1 at compile time.
Define _TANDEM_SOURCE in the module or at compile time. This toggle is not needed for
strictly compliant applications.
Link the module with the sockets SRL or DLL, or the static sockets library, if it uses any of the
Internet domain support functions listed in Table 14.
To compile an OSS application module that contains Guardian sockets calls:
Define _GUARDIAN_SOCKETS in the module or in the make file used to compile the program.
Define _TANDEM_SOURCE in the module or in the make file used to compile the module.
Link the module with the sockets SRL or DLL, or the static sockets library.
Internet domain sockets have an additional set of support functions: Internet domain database
query, socket end-point value query, and Internet address manipulation functions. The SRL zinetsrl
is provided for TNS/R native applications and the DLL zinetdll is provided for TNS/E native
applications; both reside in the /G/SYSTEM/SYSnn directory. The static library /usr/lib/
libinet.a is provided for G-series TNS socket applications.
Table 14 summarizes these support functions. The functions are described in the OSS reference
pages online and in the Open System Services Library Calls Reference Manual.
Table 14 Additional Internet Domain Support Functions
DescriptionFunction
Frees an address information structure created by a previous getaddrinfo()
function call
freeaddrinfo()
Frees hostent structure previously allocated by getipnodebyaddr or
getipnodebyname
freehostent()
Aids applications in printing error messages returned by getaddrinfo()gai_strerr()
Converts host names and service names to socket address structuresgetaddrinfo()
Gets the name of the host with the specified Internet addressgethostbyaddr()
Gets the Internet address of the specified hostgethostbyname()
Gets the ID of the local hostgethostid()
Gets the name of the local hostgethostname()
Gets a network host entry by address (protocol-independent)getipnodebyaddr()
Gets host information based on IP node name (protocol-independent)getipnodebyname()
Converts a protocol-independent host address to a host name and gives the
service name
getnameinfo()
Gets the name of the network with the specified network addressgetnetbyaddr()
Gets the Internet address of the network with the specified network namegetnetbyname()
184 Porting or Migrating Sockets Applications