my $sock = IO::Socket::INET->new( PeerAddr => '10.0.0.1', PeerPort => '22222', Proto => 'tcp', ); print "Connection to 22010 is open\n" if $sock->connected(); my $buf; $sock->send( $msg ); $sock->recv( $buf, 200 ); print "Message: $msg\n"; print "Response: $buf\n"; $sock->close();