I have a client that every 8 seconds will send a packet to a server. If the server detects the packets are sent too fast it will disconnect the client. In the client I call Sleep(8000); before sending the packet. On the server side I use GetTickCount(); to calculate the time between the packets. I expected this to work without any problems but I keep getting disconnected.
I used WireShark to check the packet times and this is what I got: Packet# Time 17 8.656064 72 16.957240 115 24.764741
24.764741 - 16.957240 = 7.807501 < 8 is the reason why I got disconnected. I don't understand this because in the client I call Sleep(8000); so it should send packets every 8 seconds or more.
The 2nd packet is late 0.3 second and the 3rd one is early about 0.2. Is there a way to send these packets in time?