Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

UDP & dropped packets

This topic is 5597 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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-

Share this post


Link to post
Share on other sites
Advertisement
There is a minimum packet size that is gaurenteed not to get fragmented. This is, from memory, 576 bytes.


Martin Piper
Argonaut Games plc.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!