On Tue, Aug 13, 2002 at 07:37:06AM +0200, Fulvio Risso wrote:
> pcap_loop() is blocking, since it returns only when the amount of packets
> requested has been read. This is because pcap_loop() loops forever,
> incrementing a packet counter each time a pacekt is received, and it returns
> only when N packets have been delivered.

Yes, but in the loop, it calls "pcap_read()".

If "pcap_read()" never blocks - i.e, *immediately* returns, even if
there are no packets to be read, rather than returning only after the
timeout expires - "pcap_loop()" won't block either, even if it hasn't
received any packets - it'll just spin in a CPU-consuming loop while
waiting for packets.

> We have the pcap_open_live() timeout; the "non blocking" property of the
> pcap_read_ex() call is due to that timeout.

When I refer to "non-blocking" mode, I'm referring to a mode where
"pcap_dispatch()" and "pcap_read()" returns immediately, without
waiting, *even if there are no packets to be read*.  That's what the
"non-blocking" mode set by "pcap_setnonblock()" does - and that's what
"non-blocking" mode means on UNIX.
-
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