I am trying to send over UDP using the following code, but i m getting strange results.
if((sendto(newSocket, sendBuf, totalLength, 0, (SOCKADDR *)&sendAddr, sizeof(sendAddr)) == bytesSent) < 0)
{
printf("Send error! - %d
", WSAGetLastError());
}
However say when the totalLength variable is set to 30 the sendto function actually returns 2292556, should it not be returning something at least around the 30 mark? I have checked the totalLength variable before using sendto and it will happily return a value i agree with, but then sendto returns a massive value. Total length is never bigger then the actual buffer size.
WSAGetLastError is just returning 0.
Thanks.