Host Name Resolution Using Registry Entries

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

In Windows XP, one common way to resolve a host name to an IP address is to use a locally-stored database file that contains mappings of IP addresses to host names. Windows Embedded CE supports host name resolution by using entries in the registry.

You can store the name-to-IP-address mapping for devices that you connect to regularly by loading HOSTS entries into the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\Host Name registry subkey. Replace Host Name with the name of your host. This subkey contains four entries, ExpireTime, ipaddr, ipaddr6 and aliases. The entries are described in TCP/IPv4 Configurable Registry Settings. Setting a large expire time guarantees that the entry is not deleted from the registry. You can also set the expire time to a short interval of time, as an offset from the current file time. When an application calls the resolver (such as gethostbyname), before a DNS or WINS request is sent, the application checks registry settings that map remote hosts to addresses. If the host name is found in the registry, the resolver returns the registry values.

Instead of entering the name each time that the device cold boots, you can configure the name of a particular device more permanently by editing the Platform.reg file. For more information about how to edit the file, see Assigning an IPv4 Address to a Device.

See Also

Concepts

Host Name Resolution for IPv4
TCP/IP Registry Settings