Kothari
Kothari

Reputation: 91

How to break loop of pcap_loop without pcap_breakloop

I have libpcap version 0.6 and linux kernel version 2.6.18 in which i cannot upgrade either of these and pcap_breakloop() function available from the version 0.8.

My question is how can I break pcap_loop() without using pcap_breakloop()?

Any help will be appreciated.

Upvotes: 2

Views: 1367

Answers (1)

user862787
user862787

Reputation:

Longer answer: you can't, but what you could try is writing your own loop, using pcap_dispatch(), and check a "should I break out of the loop?" flag before each call to pcap_dispatch().

This isn't as good, as pcap_dispatch() might also loop, and that wouldn't break out of the loop, although, in libpcap 0.6 (which is REALLY old, BTW - older than the 2.6.18 kernel, as far as I know), it doesn't loop on Linux.

Upvotes: 1

Related Questions