Currently the 'timeout' and 'immediate' options map to pcap_set_timeout
and pcap_set_immediate_mode, where the latter is activated by default.
Thus the timeout is only honoured when 'immediate' is set to false. In
addition the timeout value 0 has an undefined behaviour according to
pcap_set_timeout(3PCAP) and may cause infinity waiting according to
pcap(3PCAP).
See also #29 for a related discussion.
Erlang/OTP timeouts are generally given by either the number of milliseconds
to wait, 'infinity' to disable the timeout or 0 (if permitted) to
do something immediately.
Change the behaviour of the 'timeout' parameter to be similar to be
compatible with the Erlang/OTP way:
N with N>0: Set this timeout (in msecs) with pcap_set_timeout and
disable immediate mode. The exact behaviour is platform
dependent.
'infinity': Wait until the pcap buffer is filled
'immediate': Enforce immediate mode
0: Deliver packets without delay (equivalent to immediate
mode)
Remove the stand-alone 'immediate' option.
Change the epcap command line option -t to use 0 for immediate mode
and <0 to represent 'infinity'.
Note that this will change the behaviour for {timeout, 0} on Linux
when using libpcap >1.5.0.
Note also that according to pcap(3PCAP) the support of "packet buffer
timeouts" may not be provided by all platforms.
Currently the 'timeout' and 'immediate' options map to pcap_set_timeout and pcap_set_immediate_mode, where the latter is activated by default. Thus the timeout is only honoured when 'immediate' is set to false. In addition the timeout value 0 has an undefined behaviour according to pcap_set_timeout(3PCAP) and may cause infinity waiting according to pcap(3PCAP).
See also #29 for a related discussion.
Erlang/OTP timeouts are generally given by either the number of milliseconds to wait, 'infinity' to disable the timeout or 0 (if permitted) to do something immediately.
Change the behaviour of the 'timeout' parameter to be similar to be compatible with the Erlang/OTP way:
Remove the stand-alone 'immediate' option.
Change the epcap command line option -t to use 0 for immediate mode and <0 to represent 'infinity'.
Note that this will change the behaviour for {timeout, 0} on Linux when using libpcap >1.5.0.
Note also that according to pcap(3PCAP) the support of "packet buffer timeouts" may not be provided by all platforms.