#usr/bin/perl use strict; use warnings; use IO::Socket; $| = 1; my $client; my $socket= new IO::Socket::INET( LocalPort => '4500', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Couln't open socket: $!" unless $socket; while(1) { $client = $socket->accept() or die sprintf "ERRRR(%d)(%s)(%d)(%s)", $!,$!,$^E,$^E; print "Socket Accepted:$client....\n"; $client->autoflush(1); my $addr = $client->peerhost(); my $port = $client->peerport(); print "Got Connection from \"$addr\" at port $port\n"; while( <$client> ) { print "$client" } }