TCP/IP Programming Manual

INT .EXT sa(sockaddr);
INT(32) salen;
STRING .EXT host;
INT(32) hostlen;
STRING .EXT serv;
INT(32) servlen;
INT(32) flags;
error
return value; if the call is successful, a 0 (zero) is returned. If the call is not successful, —1 is
returned. If the call failed, the external variable error is set as indicated in Errors (page 119).
sa
input value; points to the sockaddr_in or sockaddr_in6 struct containing the IP address
and port number.
salen
input value; specifies the length of the sa argument.
host
input and return value; contains the hostname associated with the IP address or the numeric
form of the host address (if the flags value NI_NUMERICHOST is used).
hostlen
input value; specifies the size of the host buffer to receive the returned value. If you specify
0 (zero), no value is returned for host. Otherwise, the value returned is truncated as necessary
to fit the specified buffer.
serv
input and return value; contains either the service name associated with the port number or
the numeric form of the port number (if the flags value of NI_NUMERICSERV is used).
servlen
input value; specifies the size of the serv buffer to receive the returned value. If you specify
0 (zero), no value is returned for serv. Otherwise, the value returned is truncated as necessary
to fit the specified buffer.
flags
NI_NOFQDN
input value; specifies to return only the hostname part of the fully qualified domain name
(FQDN) for local hosts. If you omit this flag, the function returns the host’s fully qualified
(canonical) domain name.
NI_NUMERICHOST
specifies to return the numeric form of the host address instead of the hostname.
NI_NAMEREQD
specifies to return an error if the hostname is not found in the DNS.
NI_NUMERICSERV
specifies to return the numeric port number instead of the service name.
NI_DGRAM
specifies to return only ports configured for a UDP service. This flag is required for ports
that use different services for UDP and TCP.
118 Library Routines