getsockname(2) - perldoc - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


    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 Author: Che Dong Under GNU General Public License
2026-06-02 19:32 @216.73.216.151 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!