[Winpcap-users] SPAM: Re: Telling the difference between devices

Guy Harris guy at alum.mit.edu
Wed Nov 21 11:25:51 PST 2012


On Nov 21, 2012, at 10:30 AM, "Joe Anello" <joe.anello at roadrunner.com> wrote:

> Thanks for that tidbit.  I was away for a couple of days and just figured
> that out a little while ago, so thanks for the confirmation.
> 
> I've gotten a few replies from folks who have suggested that simultaneous
> capture on multiple ports doesn't work, but that has me very confused...

I think *they're* confused.

The pcap APIs aren't thread-safe in the sense that a given pcap_t * handle can be manipulated in more than one thread at a time; there are no locks on pcap_t's to prevent collisions if you do that.

However, as long as you have a separate thread for each pcap_t * handle, you can capture from more than one pcap_t * handle at a time.

In addition, you could do all the capturing in a single thread, with a wait loop that uses select()/poll()/epoll()/kqueues on UN*X or WaitForMultipleObjects()/MsgWaitForMultipleObjects() on Windows, although that means that you don't make use of multiple processors/processor cores.


More information about the Winpcap-users mailing list