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 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; }
}
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; }