Pike v8.1 release 6

Method NetUtils.ip_to_string()


Method ip_to_string

string ip_to_string(int ip, bool|void v6_only)

Description

Converts a binary representation of an IP address into the IPv4 or IPv6 string representation.

The reverse of string_to_ip.

Parameter ip

The binary representation of the address.

Parameter v6_only

Always return IPV6 addresses. IPV4 addresses will be formatted as ::FFFF:<ipv4>

Returns

The string representation of the address, or 0 if the IP was invalid.