Name
ToIP -- convert host name to IP address (V5.0)
Synopsis
ip$ = ToIP(host$[, protocol])
Function
This function can be used to resolve the IP address of the specified host name. The IP address of the host will be returned as a string. To get the host of an IP address, use ToHostName().

Starting with Hollywood 8.0, there is an optional new protocol argument which allows you to specify the Internet protocol that should be used for the resulting IP address. This can be one of the following special constants:

#IPV4:
Use 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:
Use 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.

#IPAUTO:
Let the host operating system determine the Internet protocol to use.

The protocol argument defaults to the default protocol type set using SetNetworkProtocol(). By default, this is #IPV4 due to historical and portability reasons. See SetNetworkProtocol for details.

To resolve a host name with advanced functionality, take a look at the ResolveHostName() function. See ResolveHostName for details.

Inputs
host$
host name to resolve
protocol
optional: Internet protocol to use (see above for possible values); defaults to the protocol type set using SetNetworkProtocol() (V8.0)
Results
ip$
IP address of the specified host

Show TOC