[Winpcap-users] Receive stops with Winpcap 3.1
lancy
lancy at cdactvm.in
Wed May 30 09:41:55 GMT 2007
Our application is to read "raw" (layer 2 type) Ethernet packets being transmitted from proprietary hardware to the host computer. We are using Winpcap 3.1. The code used to initialize is given below:
if ((adhandle[i-1]= pcap_open_live(d->name, // name of the device
65536, // portion of the packet to capture.
// 65536 grants that the whole packet will be captured on all the MACs.
1, // promiscuous mode (nonzero means promiscuous)
10, // read timeout
errbuf // error buffer
)) == NULL)
{
MessageBox(NULL,"Unable to open the adapter","d->name",MB_OK);
/* Free the device list */
pcap_freealldevs(alldevs);
Errorcode=1;
return Errorcode;
}
/*****Sets the Kernel buffer to 512000 bytes*****/
if(pcap_setbuff(adhandle[i-1],512000) ==-1) {
MessageBox(NULL,"Error in pcap_setbuff","d->name",MB_OK);
pcap_close(adhandle[i-1]);
Errorcode=1;
return Errorcode;
}
/*****Sets the filter to accept only broadcast packets *****/
if (mode == 1 )//broadcast mode
{
if(pcap_compile(adhandle[i-1], &fcode, "ether broadcast", 1, 0xffffff) < 0)
{
Errorcode=1;
pcap_close(adhandle[i-1]);
return Errorcode;
}
//set the filter
if(pcap_setfilter(adhandle[i-1], &fcode)<0)
{
pcap_close(adhandle[i-1]);
Errorcode=1;
return Errorcode;
}
pcap_next_ex is used to read packets.
The program works for 10-12 days and then it seems that receive operation stops. Once the program is closed and started again, everything is OK.
Is there a possibility that recive stops when kernel buffer reaches the end ?
Regards
Lancy Thomas
______________________________________
Scanned and protected by Email scanner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070530/6208a0ac/attachment.htm
More information about the Winpcap-users
mailing list