TCP/IP Programming Manual

Also, see Using the DEFINE Command (page 29) for more information about setting file names
and process names.
Your program calls gethostbyname and getaddrinfo routines to get the hostname and IP
addresses. Guardian socket library gets the hostname and IP addresses as follows:
1. If there is a DEFINE for =TCPIP^HOST^FILE, and if hostname is found, it is returned from
this file.
If =TCPIP^HOST^FILE is not defined, DNS is queried for the hostname. If hostname is found,
it is returned.
If hostname is not found in DNS, default hosts file $SYSTEM.ZTCPIP.HOSTS is searched,
and if found, hostname is returned.
If hostname is not found in hosts file, HOST_NOT_FOUND error is returned in h_errno
parameter.
2. If there is a DEFINE for =TCPIP^NODE^FILE, IP addresses for the given host are searched,
and if IP addresses are found, they are returned.
If host is not found in =TCPIP^NODE^FILE, and =TCPIP^HOST^FILE is defined, IP addresses
are searched for in this file. If found, IP addresses are returned from the hosts file.
If =TCPIP^HOST^FILE is not defined, Guardian socket library queries DNS for hostname.
NOTE: Define =TCPIP^HOST^FILE to avoid querying DNS for IP addresses.
You can override the Guardian socket library's default behavior for hostname search by using
PARAM, as shown below:
PARAM TCPIP^RESOLVER^ORDER value
where value is one of
DNSONLY
Guardian socket library queries only DNS for the hostname.
HOSTFILEONLY
Guardian socket library searches only the hosts file for hostname.
DNS-HOSTFILE
Guardian socket library queries DNS. If hostname is not found, searches the hosts file for
hostname.
HOSTFILE-DNS
Guardian socket library searches the hosts file. If hostname is not found, it queries DNS for
hostname.
NOTE: PARAM name and value are not case sensitive.
When the process has no PARAMs and DEFINEs, Guardian socket library queries the DNS for
hostname.
Resolving Names With a Name Server
If a name server is available on the network, the recommended method for resolving names is to
access the name server. To ensure that the resolver accesses a name server rather than a host file,
your program should call the gethostbyname or gethostbyaddr routine or getaddrinfo
or getnameinfo (for NonStop TCP/IPv6 or CIP), and program users should not define a value
for =TCPIP^HOST^FILE.
To access a name server, the resolver uses information specified in a resolver configuration file.
The default name for this file is $SYSTEM.ZTCPIP.RESCONF. (For a description of this file, see
the TCP/IPv6 Configuration and Management Manual or the Cluster I/O Protocols Configuration
and Management Manual.)
TCP/IP Programming Fundamentals 27