Chapter Contents

Previous

Next
Network Administration

gethostbyname and Resolver Configuration

Under the UNIX environment, the gethostbyname and gethostbyaddr routines may use the /etc/hosts file, or they may call the resolver to contact the name server for the host name information.

The SAS/C Socket Library uses the following logic when looking up host names and addresses:

  1. looks for the /etc/resolv.conf file using the rules listed in /etc/resolv.conf. If the socket library finds the /etc/resolv.conf file, it performs the requested queries through the resolver, and it returns any answer it receives. If attempts to connect to name servers are refused ( errno ECONNREFUSED ), it goes to step 3.

  2. looks for a data set in the format of the IBM TCP/IP file TCPIP.DATA under OS/390, or TCPIP DATA under CMS. The search rules for this data set are those used by IBM TCP/IP. The socket library
    1. looks for the environment variable TCPIP_DATA string. If found, the string is passed to fopen

    2. looks for the data set identified by the DDname SYSTCPD. If found, the filename is passed to fopen

    3. looks for tso-prefix.TCPIP.DATA under TSO

    4. looks for the SYS1.TCPPARMS(TCPDATA) data set

    5. looks for the environment variable TCPIP_PREFIX and then searches for tcpip_prefix.TCPIP.DATA

    6. uses the default value of TCPIP_PREFIX and searches for default-value.TCPIP.DATA

    7. looks for TCPIP.DATA.

  3. if attempts to connect to name servers defined in TCPIP.DATA are refused, the socket library looks for an /etc/hosts file using the rules listed in /etc/hosts. If the socket library finds an /etc/hosts file, it returns the result, including failure.

Determining the domain name in name-server queries follows the same logic as the UNIX operating system in using the domain statement of the /etc/resolv.conf file, the file specified by the HOSTALIASES environment variable and the value of the LOCALDOMAIN environment variable. Name-server addresses are also determined from the /etc/resolv.conf file.

If, because there is no /etc/resolv.conf file, an IBM TCP/IP TCPIP.DATA file is read, resolver configuration is determined by the statements, including IBM defaults, in the TCPIP.DATA file. The SAS/C Library only recognizes the first three name servers specified in this file. Both the UNIX operating system and the SAS/C environment have a limit of three name servers.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.