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 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: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/