perldoc > getsockname(2)

    getsockname SOCKET
            Returns the packed sockaddr address of this end of the SOCKET
            connection, in case you don't know the address because you have
            several different IPs that the connection might have come in on.

                use Socket;
                my $mysockaddr = getsockname($sock);
                my ($port, $myaddr) = sockaddr_in($mysockaddr);
                printf "Connect to %s [%s]\n",
                   scalar gethostbyaddr($myaddr, AF_INET),
                   inet_ntoa($myaddr);

Generated by phpman v9.9.10-37-gcf157e7 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-10-08 18:18 @216.73.217.162
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!