diff options
author | Guy Harris <gharris@sonic.net> | 2020-06-07 13:34:35 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-06-07 13:34:35 -0700 |
commit | 7b8c17a8ea76e7df7dce5c15dc6864505e9e66ac (patch) | |
tree | 92f191d6e73e3d9ea3bc4988dbf6baf13218fd48 /pcap_setnonblock.3pcap | |
parent | 0d43f600f9a64fa72421923c8ac65e9a084d1fdd (diff) |
doc: say what pcap_next_ex() does, clarify issues with other routines.
Document that pcap_next_ex() will, in non-blocking mode, return 0 if no
packets are immediately available.
Document precisely why pcap_loop() and pcap_next() don't behave well in
non-blocking mode.
[skip ci]
Diffstat (limited to 'pcap_setnonblock.3pcap')
-rw-r--r-- | pcap_setnonblock.3pcap | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pcap_setnonblock.3pcap b/pcap_setnonblock.3pcap index 96a9131d..a38ca0d7 100644 --- a/pcap_setnonblock.3pcap +++ b/pcap_setnonblock.3pcap @@ -49,16 +49,26 @@ is returned and .I errbuf is filled in with an appropriate error message; otherwise, 0 is returned. +.PP In ``non-blocking'' mode, an attempt to read from the capture descriptor with .BR pcap_dispatch (3PCAP) +and +.BR pcap_next_ex (3PCAP) will, if no packets are currently available to be read, return 0 immediately rather than blocking waiting for packets to arrive. +.PP .BR pcap_loop (3PCAP) -and +will loop forever, consuming CPU time when no packets are currently +available; +.BR pacp_dispatch () +should be used instead. .BR pcap_next (3PCAP) -will not work in ``non-blocking'' mode. +will return NULL if there are no packets currently available to read; +this is indistinguishable from an error, so +.BR pcap_next_ex () +should be used instead. .PP When first activated with .BR pcap_activate (3PCAP) |