1 .\" Copyright (c) 1994, 1996, 1997
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that: (1) source code distributions
6 .\" retain the above copyright notice and this paragraph in its entirety, (2)
7 .\" distributions including binary code include the above copyright notice and
8 .\" this paragraph in its entirety in the documentation or other materials
9 .\" provided with the distribution, and (3) all advertising materials mentioning
10 .\" features or use of this software display the following acknowledgement:
11 .\" ``This product includes software developed by the University of California,
12 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 .\" the University nor the names of its contributors may be used to endorse
14 .\" or promote products derived from this software without specific prior
15 .\" written permission.
16 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .TH PCAP_SETNONBLOCK 3PCAP "25 July 2018"
22 pcap_setnonblock, pcap_getnonblock \- set or get the state of
23 non-blocking mode on a capture device
27 #include <pcap/pcap.h>
32 char errbuf[PCAP_ERRBUF_SIZE];
36 int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
37 int pcap_getnonblock(pcap_t *p, char *errbuf);
42 puts a capture handle into ``non-blocking'' mode, or takes it out
43 of ``non-blocking'' mode, depending on whether the
45 argument is non-zero or zero. It has no effect on ``savefiles''.
50 is filled in with an appropriate error message; otherwise, 0 is
53 ``non-blocking'' mode, an attempt to read from the capture descriptor
55 .BR pcap_dispatch (3PCAP)
56 will, if no packets are currently available to be read, return 0
57 immediately rather than blocking waiting for packets to arrive.
61 will not work in ``non-blocking'' mode.
63 When first activated with
64 .BR pcap_activate (3PCAP)
66 .BR pcap_open_live (3PCAP) ,
67 a capture handle is not in ``non-blocking mode''; a call to
69 is required in order to put it into ``non-blocking'' mode.
72 returns the current ``non-blocking'' state of the capture descriptor; it
73 always returns 0 on ``savefiles''.
78 is filled in with an appropriate error message.
81 is assumed to be able to hold at least
86 .BR pcap_next_ex (3PCAP),
87 .BR pcap_geterr (3PCAP)