Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcap_open_live is not thread safe #26

Open
omarekik opened this issue Nov 14, 2020 · 1 comment
Open

pcap_open_live is not thread safe #26

omarekik opened this issue Nov 14, 2020 · 1 comment

Comments

@omarekik
Copy link

pcap_open_live is thread safe in winpcap 4.1.3 but not in win10pcap.

@omarekik
Copy link
Author

As workaround for capturing packets of all interfaces, we need to open adapter devices sequencely in the main program and then for each opened adapter device we can create a thread to read the packets from the device and dump them to a pcap file.

main program { fp= pcap_open_live(adapterName.c_str(), 65535, 0, 500, errorBuffer)}

Thread:
while (!stopDumping)
{
pcap_next_ex( fp, &header, &pkt_data);
pcap_dump((u_char*)dumpfile, header, pkt_data);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant