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]

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



 
  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/


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