Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Find the other end of a socket ...Get socket options on a given ... (Berikutnya)
Low-level socket functions

Retrieve the sockaddr for a given socket

Daftar Isi

  • 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 differentIPs 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);
 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Find the other end of a socket ...Get socket options on a given ... (Berikutnya)