Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL getpeername Function
Syntax
Definition and Usage
Returns the packed socket address of the remote host attached to SOCKET.
Return Value
Example
Usage Example: Here SOCK is the socket ID of the peer socket. This is the piece of program to use getpeername().
#!/usr/bin/perl
use Socket;
$hersockaddr = getpeername(SOCK);
($port, $iaddr) = sockaddr_in($hersockaddr);
$herhostname = gethostbyaddr($iaddr, AF_INET);
$herstraddr = inet_ntoa($iaddr);
|
|

|
|
|