Mail Archives: cygwin-developers/2002/07/04/07:56:28
I am trying to get an interruptable connect and i have some difficulties.
The main problem is that it seems to be impossible to cancel a nonblocking
connect other than closing the socket. I already thought about closing the
socket and replacing it with a new one, but this requires that all
sockoptions and states have to be restored for the new one execpt the
Another possibility is to set errno to EINTR, return and let the
connect keep going.
The app can now react in different ways :
The signal handler terminates the program.
The program checks for the error and close the socket.
connect is called in a loop like
res = connect(...);
Now the program returns to the connect function, the real connect returns
WSAEALREADY or WSAEISCONN, it can be checked that the connect was
interrupted and it can be continued.
No big deal.
The error is ignored and the socket is not closed:
Now there are 2 possibilies.
a. The connect fails.
b. The connect succeds. Now exists an orphaned connection that can block
Any suggestions ?
- Raw text -