in reply to How time out can be done here?

Read alarm. One way to do it:
my $sec = 3; $SIG{ALRM} = sub { warn "Time out message: timed out after $sec seconds\n"; exit; }; alarm($sec); $MySocket->recv ($text,1000); alarm(0);

Maybe you should localize the signal handler:

{ local $SIG{ALRM} = sub { ...}; alarm($sec); $MySocket->recv ($text,1000); alarm(0); }
so that the alarm handler is visible only to the portion of code for which it is meant.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}