delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/27/04:10:15

X-Spam-Check-By: sourceware.org
Date: Wed, 27 Jun 2007 10:09:48 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Socket inheritance with fork/dup2/exec
Message-ID: <20070627080948.GI7379@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <200706212245 DOT l5LMjELU006807 AT chi DOT hcst DOT net> <20070622072042 DOT GG7379 AT calimero DOT vinschen DOT de> <ba40711f0706220834oabba902necda67280dd8c3f8 AT mail DOT gmail DOT com>
Mime-Version: 1.0
In-Reply-To: <ba40711f0706220834oabba902necda67280dd8c3f8@mail.gmail.com>
User-Agent: Mutt/1.4.2.2i
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 Jun 22 11:34, Lev Bishop wrote:
> On 6/22/07, Corinna Vinschen wrote:
> 
> >However, the next version of Cygwin will use standard DuplicateHandle
> >calls as for normal file handles.  Consequentially your
> >your test application appears to work with a Cygwin built from CVS:
> 
> But MSDN says:
> You should not use DuplicateHandle to duplicate handles to the
> following objects:
> 
>     * I/O completion ports. No error is returned, but the duplicate
> handle cannot be used.
>     * Sockets. No error is returned, but the duplicate handle may not
> be recognized by
> Winsock at the target process. Also, using DuplicateHandle interferes
> with internal reference  counting on the underlying object. To
> duplicate a socket handle, use the
> WSADuplicateSocket function.

I see this mentioned on the MSDN web pages, but I don't see this on my
very recent MSDN Library DVD.  Only I/O completion ports are mentioned
as not being duplicatable by DuplicateHandle.  Sockets are in the list
of duplicatable objects.  It would be really weird, too, since it was
never a problem to duplicate a socket on NT.  We only ever had problems on
95/98/Me.  These 95/98/Me problems were the reason to switch Cygwin
from using DuplicateHandle on sockets to WSADuplicateSocket/WSASocket
back in 2000.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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