Re: alarm and pcap::loop



Hello,

This is odd ... if I use Proc::Simple to run the sub routine in the background the alarm works fine. I then simple shutdown the second process using Proc::Simple's kill function.

Michael



Michael Gale wrote:
Hello,

    I am having a problem with the following piece of code:

Current Net::Pcap is setup to have a capture limit of 1. So if 1 packet is received my script exits and prints the message "time out did not occure. But if a packet arrives after the timeout it prints "time out occured".

But with use of the alarm function, should it not be exiting after 10 seconds even if a packet has not been received ??


--snip--
&packet_cap_setup();
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm 10;
Net::Pcap::loop($pcap_t, 1, \&packet_cap_process, 'dhcp');
alarm 0;
} ;
if ($@) {
die unless $@ eq "alarm\n";
print "Time out occured\n"; } else {
print "Time out did not occue\n";
}
&packet_cap_close();
--snip--


Thanks

Michael

.



Relevant Pages

  • alarm and pcap::loop
    ... Current Net::Pcap is setup to have a capture limit of 1. ... So if 1 packet is received my script exits and prints the message "time out did not occure. ... But with use of the alarm function, should it not be exiting after 10 seconds even if a packet has not been received ?? ...
    (perl.beginners)
  • Re: Creating and Destyoying Dialog Box Continuosly.
    ... It still looks like a memory leak somewhere. ... For drawing the graphs, ... In the same packet itself I am ... getting the alarm rising condition and also the alarm removing condition. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Creating and Destyoying Dialog Box Continuosly.
    ... Here afetrthe GUI is hanged and the memory status remains the same. ... For drawing the graphs, ... In the same packet itself I am ... getting the alarm rising condition and also the alarm removing condition. ...
    (microsoft.public.windowsce.embedded.vc)
  • Napco Netlink Module NL-Mod w/ PCD Manager
    ... Once its setup its kinda neat. ... Its great for configuring an X255 with card ... and alarm users. ... Its a little weird to setup though, and getting the PCD Manager software ...
    (alt.security.alarms)
  • Re: Garmin and Anchor Drag Alarm
    ... replacing the alarm until reset with a self resetting alarm. ... On the Setup menu there is a Marine menu. ... That has four alarms, Anchor Drag, Off Course, Deep Water, and Shallow Water. ... The Marine menu cannot be displayed as one of the pages in the page sequence but the Setup menu can be accessed from any page, then the Marine menu selected from the Setup menu. ...
    (sci.geo.satellite-nav)