unpack_sockaddr_in6#

Split a packed sockaddr_in6 into port, 16-byte address, scope id, and flow-info.

Σύνοψη#

my ($port, $addr, $scope_id, $flowinfo) = unpack_sockaddr_in6($sockaddr);

Τι επιστρέφεται#

A four-element list. When the input is shorter than a sockaddr_in6, all four elements come back as undef.

Παραδείγματα#

my ($port, $addr, $scope, $flow) = unpack_sockaddr_in6(getpeername($sock));
printf "[%s%%%d]:%d\n", inet_ntop(AF_INET6, $addr), $scope, $port;

Οριακές περιπτώσεις#

  • Scope id and flow-info are often 0 for non-link-local traffic.

  • Input shorter than sockaddr_in6 yields four undefs.

  • The family byte is not validated - pass an IPv6 sockaddr.

Διαφορές από το upstream#

Fully compatible with upstream Socket.

Δείτε επίσης#

  • pack_sockaddr_in6 - reverse direction.

  • unpack_sockaddr_in - IPv4 counterpart.

  • inet_ntop - turn the returned packed address into a string.