delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/14/10:04:21

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 14 Dec 2007 09:03:32 -0600
From: Brian Ford <Brian DOT Ford AT FlightSafety DOT com>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: FW: Combining winpcap packet wait with poll/select in cygwin
In-Reply-To: <BAY128-W1624A8046E37E24A3CBB39D2670@phx.gbl>
Message-ID: <Pine.CYG.4.58.0712140843520.3644@PC1163-8460-XP.flightsafety.com>
References: <BAY128-W1624A8046E37E24A3CBB39D2670 AT phx DOT gbl>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list 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
issues?

> 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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019