1

So i'm writing an app that sends 5Kb packets out 15 times a second through UDP. I understand I will lose some packets but I seem to be losing all my packets after the first couple seconds. Even if I slow it down to send the 5Kb packets out once every 10 seconds I will still lose them. What would cause this?

Ricky Casavecchia
  • 560
  • 3
  • 9
  • 28

2 Answers2

3

It's not surprising that they are all dropped. A payload bigger than 512 bytes is unlikely to make it out of the network. It depends on the MTU of your router and how much bandwidth is allocated to UDP / internet traffic on the router.

Community
  • 1
  • 1
Deepak Bala
  • 11,095
  • 2
  • 38
  • 49
  • So if I manually split the packet into 512 chunks and send them separately would it work, even through I am sending the same amount of data? I had always thought that the packets automatically got broken down into the correct MTU size by your router and by other routers on the way to the packets destination, and then will be reassembled when they reach their destination. – Ricky Casavecchia Apr 05 '13 at 20:02
  • Yes a reduced payload size will help. – Deepak Bala Apr 06 '13 at 06:11
  • This worked great! I had to split the packets up and then reassemble them on the other end which took a little extra overhead, but it works. Thank you very much, I have had this problem many times when dealing with UDP and never realized this was the problem. – Ricky Casavecchia Apr 08 '13 at 15:53
2

You'll be lucky to get any UDP datagram larger than about 1260 bytes at all. The generally accepted limit for UDP through routers is 534 bytes, which derives somehow from the IPv4 non-fragmentation minimum of 576 bytes.

user207421
  • 305,947
  • 44
  • 307
  • 483