TCP/IP Programming Manual

Table 13 Support Routines (continued)
FunctionsRoutine Name
Converts hostnames and service names into socket address structures.
(Supported for NonStop TCP/IPv6 only.)
lwres_getaddrinfo (page 142)
Gets the name of the host that has the specified Internet address and
address family. (Supported for Parallel Library TCP/IP only.)
lwres_gethostbyaddr (page 144)
Gets the Internet address (IPv4) of the host whose name is specified.
(Supported for NonStop TCP/IPv6 only.)
lwres_gethostbyname (page 145)
Gets the Internet address (IPv4 or IPv6) of the host whose name is
specified. (Supported for NonStop TCP/IPv6 only.)
lwres_gethostbyname2 (page 146)
Searches host entries until a match with src is found. (Supported for
NonStop TCP/IPv6 only.)
lwres_getipnodebyaddr (page 147)
Gets host information based on the hostname. (Supported for
NonStop TCP/IPv6 only.)
lwres_getipnodebyname (page 149)
Translates a protocol-independent host address to a hostname.
(Supported for NonStop TCP/IPv6 only.)
lwres_getnameinfo (page 150)
Returns an appropriate string for the error code given by err_num.
(Supported for NonStop TCP/IPv6 only.)
lwres_hstrerror (page 152)
Syntax and Semantics of Socket Library Routines
This subsection describes each routine in the socket library. The routines are listed alphabetically.
Each description includes the following information:
What the routine does
What headers you need to specify in an #include statement within your programs before
calling the routine
What arguments the routine accepts and how it interprets them
What value the routine returns and how you should interpret it
What types you must declare for each argument and for the return value
What errors can be returned
What guidelines you need to consider when using the routine
Many of the descriptions include an example that shows how to use the routine.
See Chapter 3 (page 62) for a summary of the C header files provided with the socket library and
for descriptions of the data structures provided in the header files.
All return codes and values are of type integer unless otherwise noted.
Nowait Routines
Most of the socket routines have two versions: one for waited operations and another for nowait
operations. The names of the nowait routines end in the suffix _nw. Except for the socket_nw
routine, the nowait routines include an additional tag parameter that is passed to the NonStop
operating system file-system procedures.
Error Conditions
Most routines that refer to a socket number (socket), plus a few support routines, indicate an
error condition by returning an otherwise impossible return value (usually -1) and placing the
appropriate error number in the external variable errno. Since errno is not cleared on successive
calls, you should test it only after an error has occurred. You can call the perror function to print
Syntax and Semantics of Socket Library Routines 85