I am using winapi function WSARecvFrom to receive UDP data on a socket, I am using overlapped IO with IOCP ports.
In the documentation its stated:
If no error occurs and the receive operation has completed immediately, WSARecvFrom returns zero.
And in the remarks:
If an overlapped operation completes immediately, WSARecvFrom returns a value of zero and the lpNumberOfBytesRecvd parameter is updated with the number of bytes received and the flag bits pointed by the lpFlags parameter are also updated. If the overlapped operation is successfully initiated and will complete later, WSARecvFrom returns SOCKET_ERROR and indicates error code WSA_IO_PENDING. In this case, lpNumberOfBytesRecvd and lpFlags is not updated.
However if the function returns 0 the buffers are not updated with any new data, but the InternalHigh member of OVERLAPPED struct (which is the same as lpNumberOfBytesRecvd
parameter, but for OVERLAPPED IO it should be NULL as per docs) is updated with a different number (which I assume is the correct number of bytes)
I have found in a forum from quite a while ago some people said when using WSARecvFrom with UDP and IOCP and it returns 0 it should just be ignored, is this really the case?
Should WSARecvFrom returning 0 for UDP with IOCP be ignored, if not, why would the documentation be so unclear?
I have also heard that IOCP is a superset of Overlapped IO and that is why im refering it to as such in this thread (im not sure if its really the case but this thread seems to confirm it)