June 2002
Beginner
759 pages
80h 42m
English
IO::Socket greatly simplifies the implementation of a socket for client communications. The following example creates an Internet-domain socket (using the INET subclass) and attempts to connect to the specified server:
use IO::Socket;
$sock = new IO::Socket::INET (PeerAddr => 'www.ora.com',
PeerPort => 80,
Proto => 'tcp');
die "$!" unless $sock;IO::Socket::INET::new
creates an object containing a socket filehandle and connects it to
the host and port specified in PeerAddr and PeerPort. The object $sock can then be written to and read from
like other socket filehandles.