Name
ResolveHostName -- convert host name to IP address (V8.0)
Synopsis
t = ResolveHostName(host$)
Function
This function can be used to convert the host name specified in host$ to an IP address. In contrast to the similar function ToIP(), ResolveHostName() returns all information it can retrieve from the resolver in a table. This is especially useful if you need to get information about the available Internet protocols for the host name. Thus, this function can return multiple IP addresses for the specified host name, e.g. one IPv4 address and one IPv6 address.

ResolveHostName() returns a table which contains a number of subtables, one for each IP address successfully resolved. Each of these subtables will have the following fields initialized:

Address:
The IP address of the specified host name in the format of the respective Internet protocol (see below).

Protocol:
The Internet protocol used by this IP address. This can be one of the following special values:

#IPV4:
Internet Protocol version 4 (IPv4). IPv4 addresses are limited to 32 bits and are represented using four numbers separated by three dots, e.g. 127.0.0.1.
#IPV6:
Internet Protocol version 6 (IPv6). IPv6 addresses use 128 bits and are represented by eight groups of four hexadecimal digits, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Note that #IPV6 is currently unsupported on AmigaOS and compatible systems.
#IPUNKNOWN:
IP address uses an unknown protocol.

Inputs
host$
host name to resolve
Results
t
a table of tables containing all information from the resolver (see above)
Example
t = ResolveHostName("www.airsoftsoftwair.de")
For Local k = 0 To ListItems(t) - 1
    Print(t[k].address, t[k].protocol)
Next
On a Windows 10 system, the code above resolves two IP address for www.airsoftsoftwair.de: One IPv4 address and one IPv6 address.

Show TOC