Use of the IPTOLONG keyword to convert between IPv4 addresses and integers
The IPTOLONG
keyword provides a mechanism to convert
an IPv4 address into a 32 bit integer.
Example
The following example converts the 1.2.3.4
IP
Address into number 16909060
.
int ipNumber = eval(int, 'IPTOLONG(`1.2.3.4`)')
To
convert in the opposite direction, you need the LONGTOIP
keyword.
The LONGTOIP
keyword provides a mechanism to convert a 32
bit integer into an IPv4 address.
The following example would convert
the number 16909060
into IP Address 1.2.3.4
.
text ipAddress = eval(text, 'LONGTOIP(16909060)')