client6.pl to HTML.

index -|- end

Generated: Sun Apr 15 11:45:57 2012 from client6.pl 2011/09/24 600.

#!/usr/bin/perl
#client
use strict;
use warnings;

use IO::Socket;

#To flush the buffer print statements
$| = 1;

my $sock = new IO::Socket::INET( PeerAddr => 'localhost', PeerPort => 
+7890, Proto => 'tcp');

if ($sock) {
   print "A tcp socket on localhost connected to 7890\n";
}
else {
   die "Error: $!";
}

my $buf = "1234567890";

$sock->say($buf);
print "Sent '$buf'\n";
$buf = $sock->getline();
chomp($buf);

print "Bytes 10 = '$buf', say('1')\n";

$sock->say("1");
$buf = $sock->getline();
chomp($buf);
print "Bytes 2 = '$buf'\n";

print "exiting...\n";

index -|- top

checked by tidy  Valid HTML 4.01 Transitional