#!/usr/bin/perl use IO::Socket; print "Running Server Porgram \n"; $server_port='1234'; $server=IO::Socket::INET->new(LocalHost=>'localhost', LocalPort=>$server_port, Proto=>'tcp', Reuse=>1, Listen=>10) or die "could not be a server on this port $server_port :$@\n"; print "TCP Server Created \n"; print "Accepting Client \n"; while($client=$server->accept()) { print "Hey client got connected \n"; $server->recv($client,$text,128); if($text ne '') { print "\nReceived message '", $text,"'\n"; } # If client message is empty exit else { print "Cilent has exited!"; exit 1; } }