Domain Name Resolution

In TCP/IP, communication is based on internet addresses. When a TCP/IP application receives a symbolic host name, it calls a host name resolver routine to resolve the symbolic name into an internet address. The host name resolver routine queries a domain name server or a local HOSTS file, or both, to perform the name resolution.

If a RESOLV2 file or RESOLV file exists in the ETC subdirectory, the host name resolver routine first tries to resolve the name by querying the name servers specified in that file.

If resolution through a name server fails or if a RESOLV2 or RESOLV file does not exist, the host name resolver routine tries to resolve the name locally by searching the HOSTS file in the ETC subdirectory for a match of the symbolic host name.

The above search order can be reversed by setting the OS/2 environment variable USE_HOST_FIRST to any nonzero value. If this variable is set, the host name resolver routine searches the local HOSTS file first before querying a domain name server.

If a match is found, the routine returns the corresponding internet address. If a match is not found, the routine displays a message stating that the host is unknown.

RESOLV and RESOLV2 files

┌───────────────────────────────────────────────────────────────────┐
│NETWORK       RESOLV FILE                RESOLV2 FILE              │
│CONNECTION                                                         │
├───────────────────────────────────────────────────────────────────┤
│LAN only                                 X                         │
│connection                                                         │
├───────────────────────────────────────────────────────────────────┤
│SLIP only     X                                                    │
│connection                                                         │
├───────────────────────────────────────────────────────────────────┤
│LAN and SLIP  X                          X (used for domain name   │
│connections                              resolution)               │
└───────────────────────────────────────────────────────────────────┘

The following resolver calls are used to make, send, and interpret packets for name servers in the internet domain:


[Back: Internet Address Manipulation]
[Next: The _res Data Structure]