[Winpcap-users] Which is faster?

Paul Heil paul.heil at gmail.com
Fri Sep 28 23:30:20 GMT 2007


I'm having performance issues with pcap_next_ex() and I was wondering if it
was any faster to use pcap_loop() with a dispatch function?
The frames I want to capture are
only 24 bytes, but I want to be able to count all of them if they
arrive at 50 frames per second. Wireshark has no trouble seeing them
all, but I only count around 90%


What I'm doing now looks like this:

PcapInit()
{
   pcap_open( timeout = 100ms );
   pcap_compile();
   pcap_setfilter();
   pcap_setmintocopy( 128 bytes );
}
ListenThread()
{
     // listen for 10 seconds after that, m_bListening is set to false by
another thread
    while( m_bListening == TRUE && pcap_next_ex( pcapHandle, &pkt_header,
&pkt_data ) >= 0 )
    {
        // walk through the radiotap and TCP/IP structures getting the data
and
        // statistics I want from the captured frames.
        ++framecounter;
    }
}

Thanks,
PaulH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070928/ffdf54ab/attachment.htm


More information about the Winpcap-users mailing list