in reply to Very basic socket question
Hi,
As aukjan said, take a look at IO::Socket::INET.
A small example:
use strict; use warnings; use IO::Socket::INET; use Socket qw(:DEFAULT :crlf); $|++; my $hostname = 'localhost'; my $port = 2001; my $sock = IO::Socket::INET->new(PeerAddr => $hostname, PeerPort => $port, Proto => 'tcp') or die "Can't connect: $!"; $sock->autoflush(1); print $sock "Hello, World!$CRLF"; # Using $CRLF is more portable close $sock;
Hope it give you an idea
Regards,
:-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Very basic socket question
by blazar (Canon) on Jun 29, 2005 at 12:38 UTC |