getsockname - perldoc.perl.org

Perl Programming Documentation
Download Perl
Explore

Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

Tools

- Preferences

# getsockname

Perl 5 version 22.0 documentation
Go to top
Show recent pages
Recently read

# getsockname

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

- 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;    $mysockaddr = getsockname(SOCK);    ($port, $myaddr) = sockaddr_in($mysockaddr);    printf "Connect to %s [%s]\n",       scalar gethostbyaddr($myaddr, AF_INET),       inet_ntoa($myaddr);