Polling under Windows outputs an error message (EWOULDBLOCK) if no data available.
The error handling in function vos_sock.c:111 recvmsg() should be revised. E.g. WSAIoCtl() will probably never return WSAEWOULDBLOCK.
recvmsg() in Windows vos_sock.c generates an error msg for WSAEWOULDBLOCK.
Instead of excluding WSAEMSGSIZE in line 137 WSAEWOULDBLOCK should be excluded for generating error messages.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It still outputs an error message if there is no data received by the function
it is outputing. "trdp_pdcom.c:972 PDframe size error (8))".
I feel that if WSARecvMsg is returning SOCKET_ERROR then numBytes will not be a valid value for our case.
So I suggest returning -1 if there is SOCKET_ERROR.
Could you please review if my suggestion will work?
else
{
pMessage->dwFlags = flags;
res = WSARecvMsg(sock, pMessage, &numBytes, NULL, NULL);
if (0 != res)
{
DWORD err = WSAGetLastError();
if (err != WSAEWOULDBLOCK)
{
vos_printLog(VOS_LOG_ERROR, "WSARecvMsg() failed (Err: %d)\n", err);
}
return -1;
}
}
return numBytes;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
recvmsg() in Windows vos_sock.c generates an error msg for WSAEWOULDBLOCK.
Instead of excluding WSAEMSGSIZE in line 137 WSAEWOULDBLOCK should be excluded for generating error messages.
It still outputs an error message if there is no data received by the function
it is outputing. "trdp_pdcom.c:972 PDframe size error (8))".
I feel that if WSARecvMsg is returning SOCKET_ERROR then numBytes will not be a valid value for our case.
So I suggest returning -1 if there is SOCKET_ERROR.
Could you please review if my suggestion will work?
else
{
pMessage->dwFlags = flags;
res = WSARecvMsg(sock, pMessage, &numBytes, NULL, NULL);
if (0 != res)
{
DWORD err = WSAGetLastError();
if (err != WSAEWOULDBLOCK)
{
vos_printLog(VOS_LOG_ERROR, "WSARecvMsg() failed (Err: %d)\n", err);
}
return -1;
}
}
return numBytes;
}
recvmsg() needs to return SOCKET_ERROR also in case of WSAEWOULDBLOCK even the error message needs to be suppressed.