Closed thegreathir closed 11 months ago
This lib is not a mirror of libpcap API, it's more an abstraction of libpcap API, thus I agree it's not possible to switch it off (using this lib only, you can always call pcap_setnonblock()
yourself), in what case would you need to switch it off ?
The value "1" is hard coded here so you can not switch off non-blocking mode as described here.
You are right. The solution would be to make the pcap
library take to: bool
parameter and cast it appropriately when calling the raw API as done here.
I may get around to this at some point (I usually batch some amount of work for pcap
before doing it), but if you submit a PR I can merge and release it as soon as it's ready.
This would however, require a major version bump, so please in your PR describe your use case.
I was testing something... I think because this API will produce a system call at the end, swtching on or off continuosly will drain performance. So I gave it up.
That why I asked you what was the use-case, I never see any usecase that needed to change the blocking mode of a socket. Also to avoid breaking change if really really this feature is needed I would first add a function and in a future breaking change merge the two functions. it's a trivial "problem" of our API I don't think bump to 2.0 is worth it. And again I don't think we need this feature at all.
The value "1" is hard coded here so you can not switch off non-blocking mode as described here.