PRB: gethostbyname() Retrieves Only One IP Address from WINS (192128)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows NT 4.0
    • Microsoft Windows 95

This article was previously published under Q192128

SYMPTOMS

When gethostbyname() attempts to resolve a host name of a multihomed computer, it might fail to list all of the IP addresses that were registered with Windows Internet Name Service (WINS) by the multihomed computer.

CAUSE

The gethostbyname() only reads the first address entry in the WINS response.

RESOLUTION

Configure Microsoft Windows TCP/IP to resolve host names using a Domain Name Server (DNS) and register all IP addresses of the multihomed computer in the DNS.

STATUS

This behavior is by design.

MORE INFORMATION

WINS is an extension of RFC 1001/1002 that provides name resolution of NETBIOS computer names. In addition to HOSTS file and DNS, you can configure Microsoft Windows TCP/IP to resolve host names using WINS. If you configure DNS, HOSTS file, and WINS, the gethostbyname() tries to resolve a host name using name services in the following order:
  1. HOSTS file
  2. DNS Server
  3. WINS Server
  4. Local Broadcasting
  5. LMHOSTS file
If the host name of a multihomed computer is found by a DNS Server, gethostbyname() can resolve the name to all IP addresses of the computer that are registered to the DNS. If they are not found by the DNS Server, it attempts to resolve the name by using WINS. The WINS server responds with a list of all IP addresses that were registered with WINS by the computer. However, the gethostbyname() can only parse the first address in the list.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbnetwork kbprb kbWinsock KB192128