Network/Socket: Fix Connect (timeout) on Windows/Linux

This commit is contained in:
Jérôme Leclercq
2018-08-30 13:03:50 +02:00
parent d0e33225b7
commit 56873b92b0
3 changed files with 3 additions and 1 deletions

View File

@@ -153,7 +153,7 @@ namespace Nz
tv.tv_usec = static_cast<long>((msTimeout % 1000ULL) * 1000ULL);
int ret = select(handle + 1, nullptr, &localSet, &localSet, (msTimeout > 0) ? &tv : nullptr);
if (ret == SOCKET_ERROR)
if (ret > 0)
{
int code = GetLastErrorCode(handle, error);
if (code < 0) //< GetLastErrorCode() failed

View File

@@ -132,6 +132,7 @@ namespace Nz
switch (errorCode) //< Check for "normal errors" first
{
case WSAEALREADY:
case WSAEINVAL: //< In case of connect, WSAEINVAL may be returned instead of WSAEALREADY
case WSAEWOULDBLOCK:
return SocketState_Connecting;