SocketSocket, sockaddr_in, sockaddr_un, inet_aton, inet_ntoa is a Perl module to load the C socket.h defines and structure manipulator | |
Download |
Socket Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Socket team
- Publisher web site:
- http://search.cpan.org/~nwclark/perl-5.8.8/ext/Socket/Socket.pm
Socket Tags
Socket Description
Socket, sockaddr_in, sockaddr_un, inet_aton, inet_ntoa is a Perl module to load the C socket.h defines and structure manipulator Socket, sockaddr_in, sockaddr_un, inet_aton, inet_ntoa is a Perl module to load the C socket.h defines and structure manipulators.SYNOPSIS use Socket; $proto = getprotobyname('udp'); socket(Socket_Handle, PF_INET, SOCK_DGRAM, $proto); $iaddr = gethostbyname('hishost.com'); $port = getservbyname('time', 'udp'); $sin = sockaddr_in($port, $iaddr); send(Socket_Handle, 0, 0, $sin); $proto = getprotobyname('tcp'); socket(Socket_Handle, PF_INET, SOCK_STREAM, $proto); $port = getservbyname('smtp', 'tcp'); $sin = sockaddr_in($port,inet_aton("127.1")); $sin = sockaddr_in(7,inet_aton("localhost")); $sin = sockaddr_in(7,INADDR_LOOPBACK); connect(Socket_Handle,$sin); ($port, $iaddr) = sockaddr_in(getpeername(Socket_Handle)); $peer_host = gethostbyaddr($iaddr, AF_INET); $peer_addr = inet_ntoa($iaddr); $proto = getprotobyname('tcp'); socket(Socket_Handle, PF_UNIX, SOCK_STREAM, $proto); unlink('/var/run/usock'); $sun = sockaddr_un('/var/run/usock'); connect(Socket_Handle,$sun);This module is just a translation of the C socket.h file. Unlike the old mechanism of requiring a translated socket.ph file, this uses the h2xs program (see the Perl source distribution) and your native C compiler. This means that it has a far more likely chance of getting the numbers right. This includes all of the commonly used pound-defines like AF_INET, SOCK_STREAM, etc. Requirements: · Perl
Socket Related Software