inet_ntoa#
Turn a 4-byte packed IPv4 address back into a dotted-quad string.
Σύνοψη#
my $str = inet_ntoa($packed_ipv4);
Τι επιστρέφεται#
A string like "192.0.2.1", or undef if the input is shorter than 4 bytes.
Παραδείγματα#
print inet_ntoa(INADDR_LOOPBACK); # 127.0.0.1
my ($port, $ip) = unpack_sockaddr_in($peer);
printf "%s:%d\n", inet_ntoa($ip), $port;
Οριακές περιπτώσεις#
Input shorter than 4 bytes returns
undef.Input longer than 4 bytes: the extra bytes are ignored.
Διαφορές από το upstream#
Fully compatible with upstream Socket.
Δείτε επίσης#
inet_aton- reverse direction, string to packed bytes.inet_ntop- same idea for IPv4 or IPv6, parameterised by family.unpack_sockaddr_in- usually the producer of the packed address.