start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.66 getservent Chapter 3
Functions
Next: 3.2.68 getsockopt
 

3.2.67 getsockname

getsockname 

SOCKET

This function returns the packed sockaddr address of this end of the SOCKET connection. (And why wouldn't you know your own address already? Because you might have bound an address containing wildcards to the generic socket before doing an accept . Or because you might have been passed a socket by your parent process - for example, inetd .)

use Socket; $mysockaddr = getsockname(SOCK); ($port, $myaddr) = unpack_sockaddr_in($mysockaddr);


Previous: 3.2.66 getservent Programming Perl Next: 3.2.68 getsockopt
3.2.66 getservent Book Index 3.2.68 getsockopt