delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/11/10:28:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Tue, 11 Jun 2002 10:27:39 -0400 (EDT)
From: David E Euresti <davie AT MIT DOT EDU>
To: <cygwin AT cygwin DOT com>
Subject: More on passing file descriptors
Message-ID: <Pine.GSO.4.30L.0206111013260.14396-100000@biohazard-cafe.mit.edu>
MIME-Version: 1.0

Hello,
	I've talked for a while and sent a couple of messages regarding
file descriptor passing through UNIX sockets.  I've done a little more
research and determined the following:

Refer to http://cygwin.com/ml/cygwin/2002-06/msg00227.html for some
details.

Unfortunately for this to work properly the message boundaries need to
be preserved.  Why? Because if I send two messages with two file
descriptors.  And you read all the data in one turn, how are you going to
return two file descriptors?

There are three solutions to preserving the message boundaries.
#1 Tag all data with lengths when using Unix sockets.  This comes at a
very little overhead.  Unfortunately if you send lots of 1 byte packets
and want to read them all at onec you won't be able to.

#2 Before sending a message with a file descriptor send a MSG_OOB msg.
This, at least in Win2k, makes the system preserve the message boundaries.
However MSDN says never to use OOB messages.

#3 Make the cygserver manage how much data is read.  i.e.  Before sending
4 bytes, tell the cygserver that you  you are sending 4 bytes,  then the
receives asks the cygserver, how much it can read.  (This seems hideous,
but probably more similar to what UNIX sockets do in UNIX.

Comments?
David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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