#!/usr/bin/perl use IO::Socket; $destination = 'www.yahoo.com'; $sock = new IO::Socket::INET (PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 23, Proto => 'tcp', ); die "Socket could not be created. Reason: $!\n" unless $sock; #Enable autoflush $|=1; #foreach (1 .. 10) { # print $sock "Msg $_: How are you?\n"; # print $sock "ping:$destination \n"; #} print $sock "ping:$destination \n"; print "Client Connected. \n"; print "Server says: ",scalar(<$sock>); $sock->autoflush(1); print $sock "Message acknowledged from the client!\n"; print $sock "Good Bye! \n"; print "Ping result =>: ",scalar(<$sock>); #while(1) #{} close ($sock)