http://qs1969.pair.com?node_id=529853

dsb has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to open a socket to a service, send a message and receive a response. With the following code, I can do just that:
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();
The trouble is that if the service is not functioning properly it does not respond, and so the call to recv hangs. It's okay if the server doesn't respond (that's kind of the point of this little smoke test), but I need to just get an empty response and move on...

Thoughts?


dsb
This @ISA my( $cool ) %SIG