On Mon, Jun 04, 2001 at 12:46:01PM -0300, WEI QU wrote:
> But it seems if there is no packet the pcap_dispatch can capture, it will
> block although I set the timeout in pcap_open_live(), the "Other
> Statements" will never have a chance to be executed if there is no packet
> for capture.

Correct - there are several platforms on which either the OS doesn't
provide a timeout in the packet capture mechanism (Linux, IRIX, some
DLPI platforms, e.g.  HP-UX) or where the timeout doesn't go off unless
at least one packet has arrived and passed the capture filter (Solaris);
on those platforms the libpcap timeout either has no effect (Linux,
IRIX, some DLPI platforms) or just batches together packets without
giving the program a chance to do something else if no packets arrive
(Solaris).

What do the other statements do? I.e., what is your program doing other
than the work done in the callback function? You may want to handle this
with, for example, "select()" or "poll()", waiting either for packets to
arrive or for something else to happen (although note that "select()"
and "poll()" don't work correctly on most BSD platforms, although I
think it may work on more recent versions of OpenBSD).
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to