Advertisement

Winsock: Stop Connecting

Started by October 08, 2002 11:57 AM
1 comment, last by Pipo DeClown 22 years, 4 months ago
How do I stop while I connect?
One solution is shutdown() and close().

Depending the network speed, a connection could be as fast as a second. I do not think you could cancel a connect process in less than a second.

Kuphryn
Advertisement
If the socket is blocking and you want to stop during a connect() call, you could have another thread call closesocket() on the blocking socket, forcing the connect() to fall through with an error. Afterwards, if the socket is an invalid value, the former thread knows that the connection attempt was forcefully aborted.
________________________________________________"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

This topic is closed to new replies.

Advertisement