Name
pcap_setnonblock — Prototype: int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf)
Synopsis
Purpose: pcap_setnonblock allows you to set the
status of a live capture as blocking or nonblocking. The
nonblock parameter should be 1
to set the status to nonblocking and 0 to set the
status to blocking (default). pcap_setnonblock is
intended for use with pcap_dispatch, and when the
live capture is set to nonblocking, pcap_dispatch
returns immediately if no packets are available for processing,
without observing any read timeouts. If the live capture is set to
block, the capture waits for packets to arrive.
pcap_setnonblock returns 0 on
success and -1 on an error with a human-readable
error message returned in errbuf.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access