You show some output, but you don't say what else happened. Did it segfault (trap)? Hang? Just terminate silently?
I've never used Pcap, so anything I say at this point is a guess, but a few things stand out in your code.
The docs say:
Read $count packets from the packet capture descriptor $pcap and call the perl function &callback with an argument of $user_data. If $count is negative, then the function loops forever or until an error occurs. Returns 0 if $count is exhausted, -1 on error, and -2 if the loop terminated due to a call to pcap_breakloop() before any packets were processed.
Which suggest to me that if you want to capture 5 seconds of input and then break the loop, you should be passing -1 for the loop count.
You probably ought to try adding a print statement in there to see a) if you are being call back and b) are you being passed anything.
I'd suggest using warn instead fo print for your debug and trace messages as stderr is unbuffered and you may not be seeing stuff that has been printed to stdout but not yet flushed.
In reply to Re^7: Shared variables between threads
by BrowserUk
in thread Shared variables between threads
by Saladino
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |