#!/usr/bin/perl -w # Client Program use IO::Socket::INET; print ">> Client Program <<"; # Create a new socket $MySocket=new IO::Socket::INET->new(PeerPort=>1234,Proto=>'udp',PeerAddr=>'phnoge'); # Send messages $def_msg="Enter message to send to server : "; print "\n",$def_msg; while($msg=<STDIN>) { chomp $msg; if($msg ne '') { print "\nSending message '",$msg,"'"; if($MySocket->send($msg)) { print ".....<done>","\n"; print $def_msg; } } else { # Send an empty message to server and exit $MySocket->send(''); exit 1; } }