1PCAP_GET_REQUIRED_SELECT_TIMEOUT(3PCAP)PCAP_GET_REQUIRED_SELECT_TIMEOUT(3PCAP)
2
3
4
6 pcap_get_required_select_timeout - get a file descriptor on which a
7 select() can be done for a live capture
8
10 #include <pcap/pcap.h>
11
12 struct timeval *pcap_get_required_select_timeout(pcap_t *p);
13
15 pcap_get_required_select_timeout() returns, on UNIX, a pointer to a
16 struct timeval containing a value that must be used as the minimum
17 timeout in select(2), poll(2), epoll_wait(2), and kevent() calls if
18 pcap_get_selectable_fd(3PCAP) returns PCAP_ERROR.
19
20 The timeout that should be used in those calls must be no larger than
21 the smallest of all timeouts returned by
22 pcap_get_required_select_timeout() for devices from which packets will
23 be captured.
24
25 The device for which pcap_get_selectable_fd() returned PCAP_ERROR must
26 be put in non-blocking mode with pcap_setnonblock(3PCAP), and an
27 attempt must always be made to read packets from the device when the
28 select(), poll(), epoll_wait(), or kevent() call returns.
29
30 Note that a device on which a read can be done without blocking may, on
31 some platforms, not have any packets to read if the packet buffer time‐
32 out has expired. A call to pcap_dispatch(3PCAP) or pcap_next_ex(3PCAP)
33 will return 0 in this case, but will not block.
34
35 pcap_get_required_select_timeout() is not available on Windows.
36
38 A pointer to a struct timeval is returned if the timeout is required;
39 otherwise NULL is returned.
40
42 This function became available in libpcap release 1.9.0. In previous
43 releases, select(), poll(), epoll_wait(), and kevent() cannot be used
44 on any capture source for which pcap_get_selectable_fd returns -1.
45
47 pcap(3PCAP), pcap_get_selectable_fd(3PCAP), select(2), poll(2),
48 epoll_wait(2), kqueue(2)
49
50
51
52 25 JulyPC2A0P1_8GET_REQUIRED_SELECT_TIMEOUT(3PCAP)