UDP & dropped packets
Hypothetical Internet Scenario:
You have data ''ABCDEFGH'' that needs to get through from your server to your client. Now lets assume that you have decided to send 3 characters at a time across (e.g. ''ABC''), but somewhere between your server and client a router can only send 1-char packets at a time, so it splits your packet up into ''A'', ''B'' and ''C''.
Now you know for a fact that you have to received your data as ''ABC'', ''DEF'' and ''GH'', but for some reason on the above mentioned routers path "subpacket" ''B'' got lost/dropped, does that mean the whole of ''ABC'' will be discarded by UDP, or will your data that you receive be ''AC''?
-G-
There is a minimum packet size that is gaurenteed not to get fragmented. This is, from memory, 576 bytes.
Martin Piper
Argonaut Games plc.
Martin Piper
Argonaut Games plc.
If a complete packet you made is fragmented by a router somewhere along the way and one of the fragments gets lost, the entire packet will be dropped. You won't have to worry about getting parts of packets. At least assuming you are using the OS's networking library.
This is why its important to have appropriately sized UDP packets. So that they don't become fragmented along the way and increase the chances of dropping an entire datagram. Fnagaton mentioned 576 (548 bytes of yours + 28 for UDP/IP4 header) bytes but this is just the minimum datagram size every link/router must support. Its actually possible some crappy links will fragment this into even smaller pieces.
As I said, you shouldn't have to worry about partial data getting through. And nowadays, 1500 (1472 of yours + 28 for UDP/IP4 header) is a good maximum size for UDP Packets. This is the MTU for ethernet. If really want to be able to accomodate people running their crappy 28.8 kbps modems then maybe 576 would be a better target.
EDIT: There is also a Don't Fragment Flag in the IP4 header you can set to disallow fragmentation.
[edited by - jermz on January 21, 2003 3:47:41 PM]
This is why its important to have appropriately sized UDP packets. So that they don't become fragmented along the way and increase the chances of dropping an entire datagram. Fnagaton mentioned 576 (548 bytes of yours + 28 for UDP/IP4 header) bytes but this is just the minimum datagram size every link/router must support. Its actually possible some crappy links will fragment this into even smaller pieces.
As I said, you shouldn't have to worry about partial data getting through. And nowadays, 1500 (1472 of yours + 28 for UDP/IP4 header) is a good maximum size for UDP Packets. This is the MTU for ethernet. If really want to be able to accomodate people running their crappy 28.8 kbps modems then maybe 576 would be a better target.
EDIT: There is also a Don't Fragment Flag in the IP4 header you can set to disallow fragmentation.
[edited by - jermz on January 21, 2003 3:47:41 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement