- or download this
my $sock = new IO::Socket::INET( PeerAddr => '127.0.0.1',
PeerPort => 12000,
...
Blocking => 1);
print $sock "Hello\n";
- or download this
my $server = IO::Socket::INET->new( LocalPort => 12000,
Proto => 'tcp',
...
print "Connected to sock\n";
print while <$sock>;
}
- or download this
use strict;
use warnings;
...
print "sock is $sock\n";
}
- or download this
$ perl SocketT.pl 1 (to launch as a server)
$ telnet localhost 12000 (in another window, to tie up the server)
$ perl SocketT.pl 2 (to test if it would connect and print out)