ActiveState homepage
docs.activestate.com
ActivePerl 5.32 Documentation
  • Get ActivePerl
      Release notes Windows installation Linux Installaton macOS Installation License
  • Get Started
      Windows Perl 5.32 docs
  • Contact Us

getpeername - perldoc.perl.org
Home  > Language reference > Functions > getpeername
Perl 5 version 32.0 documentation

getpeername

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

    Returns the packed sockaddr address of the other end of the SOCKET connection.

    1. use Socket;
    2. my $hersockaddr = getpeername($sock);
    3. my ($port, $iaddr) = sockaddr_in($hersockaddr);
    4. my $herhostname = gethostbyaddr($iaddr, AF_INET);
    5. my $herstraddr = inet_ntoa($iaddr);
Documentation built with Hugo using the Material theme.
ActiveState Platform   Downloads   Community   Code Recipes  
© 2020 ActiveState Software Inc. All rights reserved. Trademarks. Privacy Policy.