UDP server strange behaviour
Hi All,
I have written a simple UDP client and server, and just started playing around with it. I am noticing some strange behaviour at the server end. Here is the scenario: the client sends 100 packets to the server, but at the server end, it wouldn't capture all of them. It would stop capturing after 95 packets, and the remaining 5 packets would be displayed when the client sends the next 100. I also tried adding some delay at the client end, but that didn't change the server behaviour. Any ideas why this could be happening. If need be, I can paste the code.
Thank you,
Vish
Re: UDP server strange behaviour
Ok, the server is experiencing packet loss - it doesn't receive the remaining packets as I have mentioned in the first post. Also, the packet size is set to 1470 (MTU). Thanks.
Re: UDP server strange behaviour
If I experience this issue, I will try to send < 96 packets and see whether the server captures them all.
Re: UDP server strange behaviour
Try augmenting the size of your server's socket receiving buffer. Here's how with Linux C++; I do not know how well this translates to VC++.
Code:
const int size = 1470 * 100; // 1470 bytes * 100 messages
setsockopt(socket_desc, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof(size));
You can also do something similar for the client's socket, but instead use SO_SNDBUF.