|
| | Free Ebook Network Programming : Network Programming with Perl.pdf
Introduction Perl provides direct access to the C library routines for socket communication. Often, arguments and return values are constants defined in the C header files, or are data structures which Perl will pass in a packed binary format. The Socket module provides these constants and also many functions for packing and unpacking these data structures The IO::Socket module provides a higher level access to creating a socket CPAN contains many modules that provide a very high level access to specific application protocols. e.g. Net::FTP, Net::SMTP, Net::DNS, etc.
Binding the socket bind takes two arguments, the first is the socket and the second is a packed address. The Socket module provides functions for packing and unpacking addresses. sockaddr_in allows you to either pack or unpack an AF_INET socket address. In a scalar context it packs and in a list context it will unpack. $paddr = sockaddr_in($port, $inaddr); ($port, $inaddr) = sockaddr_in($paddr); If the use of context here disturbs you then you can explicitly call pack_sockaddr_in and unpack_sockaddr_in
Download free ebook : Network_Programming_with_Perl.pdf Free downloadable ebook in Network Programming with Perl
|
|