[Winpcap-users] Receive stops with Winpcap 3.1
    Gianluca Varenni 
    gianluca.varenni at cacetech.com
       
    Wed May 30 15:29:39 GMT 2007
    
    
  
  ----- Original Message ----- 
  From: lancy 
  To: winpcap-users at winpcap.org 
  Sent: Wednesday, May 30, 2007 2:41 AM
  Subject: [Winpcap-users] Receive stops with Winpcap 3.1
  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 ?
Uhm... no. Do you know the number of packets that got received before the receive stops? I just need an estimate.
GV
  Regards
  Lancy Thomas
______________________________________
Scanned and protected by Email scanner
------------------------------------------------------------------------------
  _______________________________________________
  Winpcap-users mailing list
  Winpcap-users at winpcap.org
  https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070530/8da6b2f7/attachment.htm
    
    
More information about the Winpcap-users
mailing list