This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FW: Combining winpcap packet wait with poll/select in cygwin

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/ right?) use a call "WaitForMultipleObjects
> ()" to sleep and wait for new receive events. I've seen some of the code
> in 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.

Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]