This question is related to What does FIONREAD of udp socket return?
I tried to use next code on Mac:
if( ioctl(socketId, FIONREAD, &totalPending) == -1 )
{
printf("%d", totalPending);
}
numBytesRecv = recvfrom(socketId, buffer, maxLen, 0, socketAddress, &socketAddressLen);
On every call where numBytesRecv != 0
, numBytesRecv == totalPending - 16
Can you please explain me why this happens? Is this return value correct? If yes, may I assume numBytesRecv == totalPending - 16
for every value numBytesRecv != 0
?