Dup'd sockets lose error information
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Apr 23 15:38:00 GMT 2014
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.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140423/892a950b/attachment.sig>
More information about the Cygwin
mailing list