```{index} single: unpack_sockaddr_in6; Socket function ``` ```{index} single: Socket::unpack_sockaddr_in6; Perl function ``` # unpack_sockaddr_in6 Split a packed `sockaddr_in6` into port, 16-byte address, scope id, and flow-info. ## Synopsis ```perl my ($port, $addr, $scope_id, $flowinfo) = unpack_sockaddr_in6($sockaddr); ``` ## What you get back A four-element list. When the input is shorter than a `sockaddr_in6`, all four elements come back as `undef`. ## Examples ```perl my ($port, $addr, $scope, $flow) = unpack_sockaddr_in6(getpeername($sock)); printf "[%s%%%d]:%d\n", inet_ntop(AF_INET6, $addr), $scope, $port; ``` ## Edge cases - Scope id and flow-info are often 0 for non-link-local traffic. - Input shorter than `sockaddr_in6` yields four `undef`s. - The family byte is not validated — pass an IPv6 sockaddr. ## Differences from upstream Fully compatible with upstream Socket. ## See also - `pack_sockaddr_in6` — reverse direction. - `unpack_sockaddr_in` — IPv4 counterpart. - `inet_ntop` — turn the returned packed address into a string.