http://www.perlmonks.org?node_id=743288


in reply to recv in socket programming

You may use IO::Select before the recv to determine if yoy can read from the socket.
Example:
my $select=new IO::Select(); $select->add($socket); if ($select->can_read($timeout)