The article you linked to at MSDN says:
If no error occurs, connect returns zero. Otherwise, it returns SOCKET_ERROR,
and a specific error code can be retrieved by calling WSAGetLastError.
If I understand your question correctly, you want to know if "connect()
did not succeed, and if that is the case, why it did not succeed". So, just check if connect()
returns SOCKET_ERROR and then check the error code by calling WSAGetLastError.
Naaff
2009-05-22 17:31:48