delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/13/20:29:12

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <BAY128-W1624A8046E37E24A3CBB39D2670@phx.gbl>
From: S A <sagarwal10 AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
Subject: FW: Combining winpcap packet wait with poll/select in cygwin
Date: Thu, 13 Dec 2007 17:28:43 -0800
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id lBE1T11Y029423


 
  Hi all
 
  (I've tried this question on the winpcap-users list already with no luck).
 
  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)?
 
   The Linux program I'm trying to port to cygwin, waits for a user to establish a telnet connection
   on a local port number (i.e. localhost). The user can then choose to send/receive raw packets
   (of any ethernet type - hence the need for raw sockets via winpcap) on any of the network devices
   on the machine.
 
   My dilemma is how to make the poll/select call i use (to wait for an incoming telnet connection
   and further interaction with the user) and combine it with using pcap_next_ex() to receive
   raw packets.
 
   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)? Or anybody have any experience doing this?
 
 
   My only other options (none of which I like) are:
 
   1. Use threads. Multiple processes won't work because the telnet program and the raw socket
      program would have to interact with each other - and wouldn't that mean more localhost connections
      unless I use some kind of proc or ioctl interface?
 
   2.  Use winpcap to also receive IP packets and thus handle the telnet protocol in my program.
       However this is unnnecessarily complex.
 
   3. Use a maximum wait time on both the poll() call and the pcap_next_ex() call and alternate
      checking between the two. I'm afraid my program will get sluggish and also eat up a lot of CPU cycles.
 
   Any recommendations on what to do or more code to look at are greatly welcomed. Thanks!

_________________________________________________________________
i’m is proud to present Cause Effect, a series about real people making a difference.
http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect

--
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