tcpdump mailing list archives

Re: libpcap & poll()


From: Eloy Paris <peloy () chapus net>
Date: Fri, 14 Nov 2008 14:03:22 -0500

Hi Gianluca,

On Fri, Nov 14, 2008 at 08:06:10AM -0800, Gianluca Varenni wrote:

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

This is very helpful; thanks for the info! It seems like there is hope
for a Windows port of my application ;-)

Cheers,

Eloy Paris.-
netexpect.org
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: