tcpdump mailing list archives
Re: libpcap & poll()
From: "Gianluca Varenni" <gianluca.varenni () cacetech com>
Date: Fri, 14 Nov 2008 08:06:10 -0800
----- Original Message ----- From: "Eloy Paris" <peloy () chapus net>
To: <tcpdump-workers () lists tcpdump org> Sent: Thursday, November 13, 2008 3:24 PM Subject: Re: [tcpdump-workers] libpcap & poll()
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.
True, select() on windows basically works on sockets only. The reason is that while on the various unix flavors select is a system call, on Windows it's a shim over the native WaitForSingleObject/WaitForMultipleObjects (as much as file descriptors are a shim over the native HANDLEs). The Windows folks decided to create this select shim over sockets, only.
On Windows, you cannot get a selectable file descriptor to make a select() on, but you can call pcap_gethandle() and use WaitForSingleObject/WaitForMultipleObjects on it. In particular you can wait on multiple pcap_t handles by getting a waitable handle on each of them and then calling "WaitForMultipleObjects" on them.
Hope it helps GV
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. Cheers, Eloy Paris.- netexpect.org - This is the tcpdump-workers list.Visit https://cod.sandelman.ca/ to unsubscribe.
- 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)
- Re: libpcap & poll() Gianluca Varenni (Nov 14)