Yes, there is one thing I first considered a bug, which isn't, because there is an immediate return if the socket is non-blocking. But this one definitely is. If you try to connect with a blocking socket with timeout, and the connection is successfull on the first "connect" call, you will end up with a Non-Blocking socket.
Maybe this is simply not possible, connect succeeding on the first time, (who knows? I don't see any reason why it can't be possible), or it just appears on loopback or something like this...
You could replace:
bool IsBlocking = myIsBlocking;
if(IsBlocking)
SetBlocking(false);
if (connect(mySocket, reinterpret_cast<sockaddr*>(&SockAddr), sizeof(SockAddr)) >= 0)
{
// We got instantly connected! (it may no happen a lot...)
return Socket::Done;
}
by:
bool IsBlocking = myIsBlocking;
if(IsBlocking)
SetBlocking(false);
if (connect(mySocket, reinterpret_cast<sockaddr*>(&SockAddr), sizeof(SockAddr)) >= 0)
{
// We got instantly connected! (it may no happen a lot...)
if(IsBlocking)
SetBlocking(true);
return Socket::Done;
}
I will do some bug research with the SocketTCP connect code... I will tell you if I know more about the return value thingy.