tcpdump mailing list archives
Re: libpcap & poll()
From: Ben Greear <greearb () candelatech com>
Date: Thu, 13 Nov 2008 15:35:11 -0800
Eloy Paris wrote:
Hi Ben, On Thu, Nov 13, 2008 at 03:13:05PM -0800, Ben Greear wrote: [...]The code above works on Solaris, but does not work on Windows since there is nothing to poll() on windows.Windows has select() but it is my understanding that you can't use it on a packet capture descriptor. At least pcap_get_selectable_fd() is not available on Windows, according to the pcap man page.
I ended up with a thread per pcap descriptor to read the windows pcap descriptor in a blocking manner, then send the packet over a local socket to my application (and running select on that socket in my main app). This is a total pain, and performs like shit, but it does allow it to basically work without rewriting the core application.
This is a major bummer for my application and is the only reason I haven't tried to attempt a port of my application to Windows. I'd love to know how to efficiently read from multiple packet capture descriptors on Linux...On Linux, I just use raw sockets, which are faster and easier to deal with than pcap..but my app is probabl different in nature from yours.If portability is not needed raw sockets are nice. The nice thing about PCAP is that it's portable.
Yep, I use both and #ifdef my code as needed. Ben -- Ben Greear <greearb () candelatech com> Candela Technologies Inc http://www.candelatech.com - This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Eloy Paris (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Gianluca Varenni (Nov 14)
- Re: libpcap & poll() Eloy Paris (Nov 14)
- Re: libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Eloy Paris (Nov 13)
- Re: libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Ben Greear (Nov 13)
- Re: libpcap & poll() Aaron Turner (Nov 13)
- Re: libpcap & poll() Aaron Turner (Nov 13)