This is the mail archive of the
mailing list for the Cygwin project.
Re: FW: Combining winpcap packet wait with poll/select in cygwin
- From: Brian Ford <Brian dot Ford at FlightSafety dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 14 Dec 2007 09:03:32 -0600
- Subject: Re: FW: Combining winpcap packet wait with poll/select in cygwin
- References: <BAY128-W1624A8046E37E24A3CBB39D2670@phx.gbl>
- Reply-to: cygwin at cygwin dot com
On Thu, 13 Dec 2007, S A wrote:
> Summary: Has anyone tried to have events (POLL_IN/POLL_OUT) on regular
> fd descriptors combined with winpcap packet receive handles
> incorporated into the same sleep event (i.e. poll/select)?
No, I haven't tried because it looked too fragile if it even works, and
Cygwin's poll/select (or the preamble to read/recv; I'm not sure yet) was
causing significant packet reception jitter in my real time application.
> I know very little of windows but I understand both winpcap & cygwin
> poll (winsup/cygwin/select.cc right?) use a call "WaitForMultipleObjects
> ()" to sleep and wait for new receive events. I've seen some of the code
> in select.cc but is there an easy way to translate the fd's into the
> HANDLE w4 array so I can somehow combine it with the winpcap HANDLE)?
You could try get_osfhandle, but I'd suggest going the other way around by
using Cygwin's cygwin_attach_handle_to_fd. I don't know if it will work
for you, but this might get you an fd that you can use in poll/select for
the winpcap handle.
> My only other options (none of which I like) are:
> 1. Use threads.
I went this route and it worked out well for me, but my application was
already threaded, and it didn't have this kind of interaction.
> 2. Use winpcap to also receive IP packets and thus handle the telnet
> protocol in my program. However this is unnnecessarily complex.
Why did you choose this strange localhost telnet IPC to begin with?
Couldn't it just be a library? I guess it might be because of privilege
> Any recommendations on what to do or more code to look at are greatly
> welcomed. Thanks!
I would appreciate you letting us know how it turns out.
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
the best safety device in any aircraft is a well-trained crew...
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html