Interruptable connect

Corinna Vinschen
Wed Feb 26 17:34:00 GMT 2003

On Wed, Feb 26, 2003 at 03:04:36PM +0100, Thomas Pfaff wrote:
> This is in accordance with
> :
> If connect() is interrupted by a signal that is caught while blocked
> waiting to establish a connection, connect() shall fail and set errno to
> [EINTR], but the connection request shall not be aborted, and the
> connection shall be established asynchronously.
> [...]
> When the connection has been established asynchronously, select() and
> poll() shall indicate that the file descriptor for the socket is ready for
> writing.

Funny, isn't it?  Just a bit of reading... *sic*.

> The connect can be changed to look like this :
> [...]

Yup, that's quite what I was thinking.

> I have not tested this code yet. I will generate a patch if you agree.

Sure!  I would be more than happy.

> BTW, i see a really strange behaviour with select and getsockopt, it seems
> that SO_ERROR is set some time after the select is signaled. Here is a
> WIN32 test case :
> [...]
> The first call to getsockopt returns 0 in sock_error, the second will
> return 10061 as expected.
> This is on NT4 German, SP6
> Can you duplicate this ?

No, I can't.  I'm running XP SP1.  The first call to getsockopt(SO_ERROR)
already returns 10061 reproducibly.

Seems to be a NT4 issue.  Anybody here with W2K?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

More information about the Cygwin-developers mailing list