I have a test application in C++ and C where a client is constantly bombarding a server with the last number that the server sent it, when the server receives one of these packets it increments the number once and then sends the new number to the client, what happens is the client is always 1 number behind the server on a local machine where both the client and server are running from, which is totally expected.
This is fine when recvfrom and sendto expect and send 9328 byte packets, however when I drop the size of the packets to 256 the client is always 33 counts out of sync, when the client is sending a 44 byte packet and the server expects 256 bytes the client is always 212 counts out of sync, every time without fail on the same machine.
I am sending these packets using the LAN IP address, the client and server are on the same machine listening through ports 3000 and 2000 respectively.
The client sends packets at the server as fast as it can. The server will only send an updated count to the client when it receives a packet.
Interestingly, when I close the client the server still processes the packets that the client has sent, so I'm guessing this is an OS bombardment protection or Windows grouping lots of small UDP packets together into one 9328 byte UDP packet.
How can I send < 256 byte packets without this happening? I want to avoid packet fragmentation as much as I can during the packet's journey so keeping a small size is a requirement for when it enters and leaves some certain hardware.