* Achado em algum site por aí !

O Servidor

cat perl-srv.pl
use IO::Socket;
my $sock = new IO::Socket::INET (
LocalHost => ‘localhost’,
LocalPort => ‘7070′,
Proto => ‘tcp’,
Listen => 1,
Reuse => 1,
);
die ” Nao foi possivel criar um socket” unless $sock;

my $new_sock = $sock->accept();
while (<$new_sock>) {
print $_;
#$new_sock = $sock->accept()
}
close($sock);

O Cliente

cat perl-cli.pl

use IO::Socket;
my $sock = new IO::Socket::INET (
PeerAddr => ‘localhost’,
PeerPort => ‘7070′,
Proto => ‘tcp’,
);
die “Nao foi possivel criar o socketn” unless $sock;

print $sock “1 2 3 testandon”;
close($sock);

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word