qq qq? Ping? On Apr 24 16:14, Corinna Vinschen wrote: > On Apr 23 17:38, Corinna Vinschen wrote: > > On Apr 23 16:25, qq qq wrote: > > > The following code is a simplified app that was used to test-connect > > > to local ports 55000+ (none of which were actually listening) and > > > received false-positive "connected" results because Cygwin's dup() > > > for socket causes SO_ERROR to be lost.  Since FD_SETSIZE is only 64 on > > > Cygwin, the app uses dup()'s to lower the descriptors as it checks > > > them for completion.  There is no such problem on Linux. > > > Also, strangely that Cygwin does not accept sin_addr as 0 to connect > > > locally (and either localhost or local host IP must be stuffed in > > > there, otherwise resulting in the "Cannot assign requested address" > > > error). > > > > This is Winsock at work. Cygwin doesn't check the AF_INET address > > when calling Winsock's connect, so Winsock's connect itself seems to > > have this issue. > > > > As for the SO_ERROR value, I have to check. Thanks for the testcase. > > I've applied a patch which should solve both problems. > > Cygwin is using socket events to implement select. It turned out that, > when using the original socket, the socket event as well as the socket's > SO_ERROR value were set correctly. However, when calling select with > the dup'ed socket handle, the socket event contained the correct error > code, but the SO_ERROR value wasn't set. I added code to write back the > error code from the socket event entry to the SO_ERROR socket option and > that seems to do the trick. > > As for connecting or sending to INADDR_ANY or in6addr_any, this simply > doesn't work with Winsock. It just returns WSAEADDRNOTAVAIL. I now > added a conversion from INADDR_ANY and in6addr_any to INADDR_LOOPBACK > and in6addr_loopback in calls to connect, sendto, and sendmsg to emulate > the Linux behaviour. > > Apart from that it turned out that 64 bit Cygwin was suffering from a > definition problem of a couple of Winsock types used in the Cygwin > socket code. As the (hopefully) only user-visible effect, this led > to a broken address output in /proc/net/if_inet6. This is fixed now > as well. > > As for FD_SETSIZE, it's defined as 64 by default, but the user code > can override the value by defining FD_SETSIZE to another value prior > to including the standard headers. The underlying code does not > restrict the file descriptor values to < FD_SETSIZE. > > Please give the today's developer snapshot from > http://cygwin.com/snapshots/ a try. Any feedback? Did you test my patch? Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat