#Client.pl use strict; use warnings; use IO::Socket; my $socket = IO::Socket::INET->new( PeerAddr =>"192.168.1.100", PeerPort =>1121, Proto =>"tcp", Type =>SOCK_STREAM, )or die ("Could not create client"); #fork the process my $child_pid; unless (defined($child_pid=fork())){die("can not fork")}; if(defined($child_pid)){ while(my $line = ){ print $socket $line; } }else{ while(my $line = <$socket>){ print "SERVER says: $line\n"; } } close($socket); <>;