Network Programming with Perl
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.
Communication protocols
There are two protocols that are mainly used
- TCP is used with a stream socket to provide a reliable, sequenced, flow-controlled channel of communication.
- UDP is used with a datagram socket and delivers datagrams to other endpoints. Message boundaries are preserved, but sequence is not and delivery is not guaranteed.
Protocols are represented as numbers, but are not available as constants. Perl provides some functions for translating protocol names to numbers and visa-versa.
…
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.
…
Website: edathua.files.wordpress.com | Filesize: 301kb
No of Page(s): 79
Click here to download Network Programming with Perl.
Related Tutorial
Tags: networking, TCP/IP
Comments
Leave a Reply