ResolveHostName -- convert host name to IP address (V8.0)
t = ResolveHostName(host$)
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:

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

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

Internet Protocol version 4 (IPv4). IPv4 addresses are limited to 32 bits and are represented using four numbers separated by three dots, e.g.
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.
IP address uses an unknown protocol.

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

Show TOC