[Winpcap-users] opening more than one adapters..

Gianluca Varenni gianluca.varenni at cacetech.com
Thu Dec 14 16:38:28 GMT 2006


  ----- Original Message ----- 
  From: Guybrush . 
  To: winpcap-users at winpcap.org 
  Sent: Thursday, December 14, 2006 7:23 AM
  Subject: RE: [Winpcap-users] opening more than one adapters..



  Hi jimmy
   
  I've had some experience with winpcap and threading. Both opening several adapters at once and even trying opening more pcap handles to the same adapter.
   
  Program is very stable now, but I have found out that its best if you place critical sections around pcap calls like
   
  pcap_open_live and pcap_findalldevs in particular.
   
  Even if you are opening 2 different adapters, calling pcap_open_live from 2 threads may cause a problem I cannot explain, I havent tried to debug it any further than to place critical sections around those calls so that there can be only thread inside these functions at a time.

Have you tried using WinPcap 4.0 beta 2/3? If for any reason WinPcap crashes while calling pcap_open_live or pcap_findalldevs from multiple threads, it's a bug. Using critical sections surrounding those calls is just a workaround...

   
  I did the same with pcap_lookupnet, pcap_compile and pcap_setfilter.

The only two functions that are not thread safe are pcap_compile and pcap_lookupdev. For the former one, the only solution at the moment is using a critical section surrounding it. For the latter, it should be considered obsolete and replaced by pcap_findalldevs.

Have a nice day
GV


 
In my program however I use pcap_loop to fetch packets, which works without critical sections.

I've used this with winpcap 3.1.
 

 


----------------------------------------------------------------------------
    From: jimmy_2000 at naver.com
    Date: Thu, 14 Dec 2006 20:34:16 +0900
    To: winpcap-users at winpcap.org
    Subject: [Winpcap-users] opening more than one adapters..


    is it possibe to open several adapters simutaneously in an process??(my application has 4 threads for each adapter)
    i'm developing some sniffing tools and my machine has 4 ethernet adapters.
    so i want to open all of adapters.
    i want to capture packets from each adapter.
     
    but on windows 2000 server, it shows critical fault and then my machine had been rebooted.
    i wonder whether my code is stupid or opening more than one adapter is impossible.
     
    is there anybody who has same experience ??
     
     
    best regrads, jimmy.
     
     

     

      
         
          새로운 기부문화의 씨앗, 해피빈!   
         
         



------------------------------------------------------------------------------


  _______________________________________________
  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/20061214/5ec71454/attachment.htm


More information about the Winpcap-users mailing list