
alager
Novice
Sep 3, 2009, 3:57 PM
Post #1 of 2
(467 views)
|
|
Win32 and alarm()
|
Can't Post
|
|
I'm making a UDP test script and the receive portion uses alarm() to test for timeouts. The problem is that calling the recv() method of IO::Socket seems to cause the alarm feature to either be reset, or just not able to create the signal. alarm() by itself works:$SIG{ALRM} = sub { die "alarm time out" }; alarm(1); sleep 4; alarm(0); This gives the message "alarm time out" However, if I try this instead, the code hangs forever if there is nothing to receive, the alarm never activates$SIG{ALRM} = sub { die "alarm time out" }; alarm($TIMEOUT); $sock->recv($msgRX, $MAXLEN) or die "recv: $!"; alarm(0); I've tried this with and without an eval around it, it doesn't seem to make a difference. Any help on this would be appreciated. Thanks, Aaron
(This post was edited by alager on Sep 4, 2009, 9:06 AM)
|