I think I already know the answer to this, so I'm just confirming:
I'm using nonblocking sockets, and when I try recieving data it returns SOCKET_ERROR with the error code WSAEWOULDBLOCK. This is the code I'm using:
void WS::SetSocketBlocking(DWORD Block)
{
if(ioctlsocket(s, FIONBIO, &Block) == SOCKET_ERROR)
{
if(ErrorCallback)
ErrorCallback("Error setting socket blocking (ioctlsocket)", WSAGetLastError());
}
}
Anyway, I'm just assuming that I should just ignore this error because it's just telling me that there just wasn't any data waiting, but I'm just making sure that this isnt' a horrible, horrible error.
Thanks!
-iago
WSAEWOULDBLOCK should just be ignored, yes, it is not a horrible, horrible error :P
if(dwWaitResult == WAIT_OBJECT_0 && bBNETConnected){
int iRecvLen = recv(sBNET, szRecvBuffer, sizeof(szRecvBuffer), 0);
if(!iRecvLen || iRecvLen == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK)
break;
ParseBNET(szRecvBuffer, iRecvLen);
}
WSAEWOULDBLOCK means "your call succeeded now, but it might fail later since the action you requested hasn't completed yet." Usually you can ignore it safely.
All right, thanks! :-)