Posted on 2007-11-14 07:25:35-08 by gnuey
alarms don't work on vms
See attached perl script. It creates a network port and waits for connections. It is suppose to time out in 30 seconds. The program works on Linux and on HPUX. But doesn't work on VMS. It never times out on VMS.
On Linux: # perl setalarm.pl setting alarm 1. process timed out at setalarm.pl line 10. closing socket On VMS (perl 5.8.6 with ECO1): $ perl setalarm.pl setting alarm Perl script: use IO::Socket::INET; my $server = IO::Socket::INET -> new ( LocalPort => 5556, Type => SOCK_STREAM, Reuse => 1, Listen => 30); eval { local $SIG{ALRM} = sub { die "process timed out"; }; print "setting alarm\n"; alarm 10; eval { my $client => $server -> accept(); }; alarm 0; print "1. $@\n" if ($@); }; alarm 0; print "2. $@\n" if ($@); print "closing socket\n"; close ($server);
Direct Responses: 6456 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.