[Winpcap-users] pcap_get_selectable_fd for WinPcap

Guy Harris guy at alum.mit.edu
Sun Apr 26 14:48:57 PDT 2009

On Apr 26, 2009, at 2:40 PM, Guy Harris wrote:

> I agree.  Welcome to the wonderful world of Windows, wherein, even if
> you *don't* use WinPcap, you have to, as far as I know, use select()
> for some events (socket events) and WaitForMultipleEvents() for other
> events (and MsgWaitForMultipleEvents() if you also need to wait for
> window system events), unless there's some way to get a waitable
> HANDLE for a socket, in which case you could use
> WaitForMultipleEvents()/MsgWaitForMultipleEvents() for everything.  It
> appears that WSAAsyncSelect() lets you turn socket events into
> *window* events, but that doesn't help for programs that aren't GUI
> programs.

Actually, it appears that, at least on Windows NT (NT 3.x, NT 4.0,  
W2K, WXP, WServer2K3, Vista, WServer2K8, W7), a SOCKET is just a HANDLE:


but they don't explicitly say whether it's a handle that can be used  
with WaitForMultipleEvents().

They also don't indicate what happens if you treat a HANDLE you get  
from something other than WinSock as a SOCKET and hand it to select().

More information about the Winpcap-users mailing list