|
you don't read the return value of the sendto function, check if all the data could be transmitted, or else wait a few ms and try again. You NIC (Well technically not the NIC itself it is in your RAM and your NIC works on it via DMA) doesn't have infinite memory (in fact due to the requirement of being a physically continuous block it is pretty limited). And if the NIC buffer is full sendto is not able to send all the data.
PS: if you want to test a protocol or an implementation you can use Omnet++ or ns-3 as simulation frameworks, both are open source, and you can test your communication in a simulation for many different scenarios you wont be able to test locally or with only a few servers.
|