X-Spam-Check-By: sourceware.org Date: Wed, 27 Jun 2007 10:09:48 +0200 From: Corinna Vinschen 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i 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 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/