Reputation: 227
I am trying to connect to a server on another machine via a non-blocking connect().
However, when I do so, Connect() returns -1, and I receive WSAEWOULDBLOCK from WSAGetLastError().
MSDN Documentation states that: It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established (reference).
The issue is that I am always receiving the error, and -1 is returned from connect() EVEN IF my server is not running.
My socket is a SOCK_STREAM socket, just as suggested. How might I remedy this? Should I provide a timeout after the connect() call to ensure that enough time is given for connect to establish a connection?
Upvotes: 1
Views: 3894