Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sun, 15 Apr 2001 22:52:27 +0200 From: Corinna Vinschen To: cygwin Subject: Re: cvs broken on win2k after recent cygwin upgrade: "The descriptor is a file, not a socket" Message-ID: <20010415225227.W20490@cygbert.vinschen.de> Mail-Followup-To: cygwin References: <010e01c0bafa$f04d9320$2b904f86 AT trinity> <07fd01c0c3dc$cf05f730$0200a8c0 AT voyager> <20010414161237 DOT A4149051 AT MELON> <20010415090728 DOT B8359 AT redhat DOT com> <20010415184450 DOT V20490 AT cygbert DOT vinschen DOT de> <20010415153631 DOT D9015 AT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010415153631.D9015@redhat.com>; from cgf@redhat.com on Sun, Apr 15, 2001 at 03:36:31PM -0400 On Sun, Apr 15, 2001 at 03:36:31PM -0400, Christopher Faylor wrote: > On Sun, Apr 15, 2001 at 06:44:50PM +0200, Corinna Vinschen wrote: > >On Sun, Apr 15, 2001 at 09:07:28AM -0400, Christopher Faylor wrote: > >> On Sun, Apr 15, 2001 at 09:22:58AM +0100, Henry S. Thompson wrote: > >> >Thanks for the observations. Seems to me to confirm Corinna's > >> >original belief that somehow Cygwin is getting the wrong WINSOCK > >> >library, even though the right one is available. > >> > >> Cygwin uses wsock32.dll. > > > >That's not quite correct. Cygwin uses ws2_32.dll if available. > >The reason is the Winsock2 functionality used for duplicating > >sockets. The old method is still implemented as a fallback, though. > > How is that implemented? I don't see it in the code. Where is > that implemented below? It's not that obvious. Since WsaStartup is called with a requested version of 2.2 in wsa_init(), the wsock32 code asks if winsock 2 is available on the system. If so, it will be used. The reason for loading ws2_32 explicitly in Cygwin is that the function pointers of the special winsock 2 functions couldn't be resolved otherwise. > Also the two tests for ws32_handle and wsock32_handle look reversed. > > cgf > > LoadDLLinitfunc (wsock32) > { > extern void wsock_init (); > HANDLE h; > > if ((h = LoadLibrary ("wsock32.dll")) != NULL) > wsock32_handle = h; > else if (!wsock32_handle) > api_fatal ("could not load wsock32.dll. Is TCP/IP installed?"); > else > return 0; /* Already done by another thread? */ > > if (!ws2_32_handle) /* IS THIS CORRECT? */ > wsock_init (); It is. WsaStartup should only be called once regardless whether the first winsock function is a version 1.1 or version 2 function. The wsa_init function is only called if it's not already called from the other entry point. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple