Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hello again Monks! :) I have a dilemma with Net::Pcap filters. I need to listen on a *very* busy device for specific packets using Net::Pcap::setfilter/compile. (I loop over a few IP addresses and listen for about 5 seconds for each one)

If I do so, the packet handler in Net::Pcap::loop($pcap, -1, \&pcap_handler, ''); never runs (until it sees the specific packet (e.g. I induce one with ping in another terminal and it works)), so I cannot seem to use alarm()! I also cannot use the Net::Pcap TimeoutOnNext, because, the network device is so incredibly busy, that it would constantly be resetting the timer, or never reset from my filters.

Have any of you Monks ever done this? I have spent about 3 days testing in Perl, searching Google and this site and found lots of resources, but none that work for my strange situation.

Here is some code that works until a filter is placed onto $pcap, I just tried it:;displaytype=displaycode;node_id=805992;part=4

Say I set the filter "src net" the alarm times out, but Net::Pcap::breakloop can't be called because Net::Pcap::loop never returns making the program hang. (until in another terminal I ping!)

Thanks in advance, you guys are awesome! :D

Edit-Edit: I just found out this is a BUG: Supposedly fixed too..(in 2005) I am still testing stuff and update frequently :(

In reply to Net::Pcap Filters and alarm() [SOLVED] by return0

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2015-10-09 18:38 GMT
    Find Nodes?
      Voting Booth?

      Does Humor Belong in Programming?

      Results (249 votes), past polls