tcpdump mailing list archives

Portable way to "block" on pcap_next_ex()


From: Fernando Gont <fernando () gont com ar>
Date: Sun, 15 Jan 2012 14:36:37 -0300

Folks,

I'd like a call to pcap_next_ex() to block, waiting for a single packet,
with no timeout.

So far, the only portable way to do it I've found is to select() on the
underlying descriptor.

The reason is that if I pcap_open_live() with a "to_ms" of 0, in some
systems pcap_next_ex() will remain blocked even if a packet is received
(i.e., it will wait for *many* packets). On the other hand, if I use a
non-zero "to_ms" in pcap_open_live(), that will mean that my app will be
awaken every "to_ms" milliseconds, because of the timeout (which is
undesirable).

Any other way of doing the same without relying on select()?

Thanks!

Best regards,
-- 
Fernando Gont
e-mail: fernando () gont com ar || fgont () si6networks com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1



-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: