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

Win10Pcap Crash in Windows10 PC #19

Open
NallasivanK opened this issue Mar 5, 2019 · 0 comments
Open

Win10Pcap Crash in Windows10 PC #19

NallasivanK opened this issue Mar 5, 2019 · 0 comments

Comments

@NallasivanK
Copy link

I use Win10pcap component as a packet sniffer in my Windows10 PC.
peridocially(say every 5 min) , I open all the NICs connected with my PC and sniff the packets and then close all the NICs.

But sometimes my exe which uses Win10Pcap crashes and all the time it points to pcap_open() call or
pcap_findalldevs_ex()..i need some help on fixing this issue.

I have give below the way the above calls made.

static pcap_t * OpenDevice(string nicName)
{
pcap_t descr = NULL; / Network interface handler /
char errbuf[PCAP_ERRBUF_SIZE]; /
Error buffer /
memset(errbuf,0,PCAP_ERRBUF_SIZE);
if ((descr = pcap_open(nicName.c_str(),
1024 /snaplen/,
0 /flags/, //PCAP_OPENFLAG_PROMISCUOUS mode is disabled
20 /read timeout/,
NULL /
remote authentication */,
errbuf))==NULL)
{
return NULL;
}

 return descr;

}

static pcap_if_t * FindAllDevices()
{
pcap_if_t * alldevs = NULL;
char errbuf[PCAP_ERRBUF_SIZE]; /* Error buffer */
memset(errbuf,0,PCAP_ERRBUF_SIZE);
if(pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL , &alldevs, errbuf) == -1)
{
alldevs = NULL;
}
return alldevs;
}

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