I
iulukus
Hi,
Is it possible to call the alarm more than once. If it is posible,
how?
I couldn't do it in my program:
{
......
......
RETRYrint "Send REQUEST to $server\n";
$payload = "x87\x00\x0c\x02\x1b\x62\x1f\x73\x96\x40\x68\x74\xfb\xff
\xff";
$lpayload = length($payload);
$dummy = syswrite($remote, $payload, $lpayload); # $remote is my UDP
socket.
print "Send REQUEST \n";
eval {
local $SIG{'ALRM'} = sub {print "abc";die "alarm\n"};
alarm 6;
sysread($remote, $result, 1024); # Read from socket
alarm 0;
};
if ($@) {
die unless $@ eq "alarm\n"; # propagate unexpected errors
goto RETRY;
# timed out
}
else {
print $@;
# didn't
}
OUTPUT:
Send REQUEST to 1.1.1.1
Send REQUEST
abcalarm
Send REQUEST to 1.1.1.1
Send REQUEST
For the second loop, program did not call the alarm subroutine and
program hang.
What can be the problem?
thanks in advance.
Is it possible to call the alarm more than once. If it is posible,
how?
I couldn't do it in my program:
{
......
......
RETRYrint "Send REQUEST to $server\n";
$payload = "x87\x00\x0c\x02\x1b\x62\x1f\x73\x96\x40\x68\x74\xfb\xff
\xff";
$lpayload = length($payload);
$dummy = syswrite($remote, $payload, $lpayload); # $remote is my UDP
socket.
print "Send REQUEST \n";
eval {
local $SIG{'ALRM'} = sub {print "abc";die "alarm\n"};
alarm 6;
sysread($remote, $result, 1024); # Read from socket
alarm 0;
};
if ($@) {
die unless $@ eq "alarm\n"; # propagate unexpected errors
goto RETRY;
# timed out
}
else {
print $@;
# didn't
}
OUTPUT:
Send REQUEST to 1.1.1.1
Send REQUEST
abcalarm
Send REQUEST to 1.1.1.1
Send REQUEST
For the second loop, program did not call the alarm subroutine and
program hang.
What can be the problem?
thanks in advance.