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]

Re: Socket inheritance with fork/dup2/exec


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/


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