So I guess, your problem is that $socket_resp->recv($recieved_data,1024); blocks until it receives 1024 bytes. Try adding Blocking => 0 to IO::Socket::INET->new() arguments. You would also probably want to substitute my $port = shift; with my $recv_port = shift; (use warnings; warned about it).#!/usr/bin/perl eval { local $SIG{ALRM} = sub { die "Timed Out"; }; alarm 3; sleep 1 while 1; alarm 0; }; alarm 0; if ($@ =~ /Timed Out/i) { print "Timed-Out waiting for infinite loop to finish\n"; }
In reply to Re: alarm not working
by aitap
in thread alarm not working
by anshumangoyal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |