On Mon, Jun 04, 2001 at 10:13:14PM -0300, WEI QU wrote:
> but the pcap_dispatch() does not return when the signal is delivered.

Right - that's a consequence of the fact that it "also continues on
EINTR".

> Does this mean I have to first use select() to wait for the return value
> of pcap_fileno() to be readable and then call pacp_dispatch()?

That might be one way of "multi-programming", i.e. of having your
program both capture and process packets *and* do something else.  (See
my other mail.)

Another possibility might be to do some of the work in the SIGALRM
handler, although the risk there is that the SIGALRM might arrive at
some arbitrary point in your program's execution, so that, for example,
some data structure the SIGALRM handler uses might be partially updated
by the main thread (although *if* the program is blocked in
"pcap_dispatch()" when the SIGALRM arrives, that's probably not a
problem).

The "select()" means that, if it's waiting for some event that causes
the program to do something other than reading captured packets, your
program doesn't have to wait for the timeout to expire before responding
to that event.
-
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