[Winpcap-users] Problems with using pcap_getevent

Swaminathan Gurumoorthy swaminathang at yahoo.com
Thu May 17 22:26:03 GMT 2007


I am relatively new to using winpcap library. I am having issues with the Win32 extension pcap_getevent() API call.
   
  I have a windows application on my host system, asynchronously reading for ethernet type packets sent by another system (again using Winpcap SendPacket() function)  . I am waiting on an event that I am holding from the pcap_getevent() call. I also have my ethereal window open to confirm if my application is reading packets when they arrive.
   
  The problem is my application is not notified when the packet actually arrives. I looked through old archives and saw a note saying it is due to the kernel buffer being set to some high value. So I modified my open call to include PCAP_OPENFLAG_MAX_RESPONSIVENESS  flag. I was hoping this will ensure the event will be triggered as soon as the packet arrives. But it did not happen. I also realized that I can use the pcap_setmintocopy() to set the buffer value So I went ahead and set this value to a low number (less than my anticipated packet size). This lead to a different problem. I see that my host program is getting the event now but it gets a slew of duplicate packets. I can see my ethereal window on the host system show duplicates as well.
   
  I am sure the client did not send all those duplicate packets becasue the ethereal window on the client system is showing only one packet. I also confirmed this by commenting out the pcap_setmintocopy() call and see only one packet on my host ethereal window (but not on my application).
   
  Am I doing something wrong here? The documentation says "use of pcap_getevent is discouraged because it is not portable" but mine is a pure windows app and I am not worried about portability.
   
  I also do not want to go to a polling mode using pcap_read_next and all that because I am using this in a thread which is waiting for other events as well. I hate to write yet another thread that will poll and send the event.
   
  Any help will be much appreciated.
   
  Thanks
  Swami
   
   


Swaminathan Gurumoorthy
1775 Milmont Dr, Apt S101
Milpitas CA 95035


       Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_ylc=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg-- hot CTA = Yahoo! Autos new Car Finder tool
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070517/0faa68e5/attachment.htm


More information about the Winpcap-users mailing list