non-blocking socket client connection

Posted by Igor on Stack Overflow See other posts from Stack Overflow or by Igor
Published on 2012-10-26T22:58:19Z Indexed on 2012/10/26 23:00 UTC
Read the original article Hit count: 177

Filed under:
|
|

ALL, I am looking for a simple example of non-blocking socket connection that will run on Windows. I tried to Google, but all samples are either for *nix (POSIX) or blocking sockets on Windows.

Looking thru msdn I see that it is easy to make a socket non-blocking and issue a connect(), but then you need some preparation in order to put the socket back.

So, all in all I need something on a non-blocking socket that will connect and then put it back to be blocking. The read and write operation should be performed on the blocking socket.

The reason for a non-blocking socket is that I need a connection timeout and there is no other way than non-blocking socket. Or is there?

Thank you.

© Stack Overflow or respective owner

Related posts about timeout

Related posts about nonblocking