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
.
Get Network Security Tools now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.