Modules

  • ABCDE
  • FGHIL
  • MNOPS
  • TUX

Tools

getsockname

Perl 5 version 8.8 documentation
Recently read

getsockname

  • 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.

    1. use Socket;
    2. $mysockaddr = getsockname(SOCK);
    3. ($port, $myaddr) = sockaddr_in($mysockaddr);
    4. printf "Connect to %s [%s]\n",
    5. scalar gethostbyaddr($myaddr, AF_INET),
    6. inet_ntoa($myaddr);