Sign in to follow this  
LonelyStar

Should one leave fragmentation to UDP?

Recommended Posts

Hi everbody, If I understand correctly one can send packages bigger than the MTU over UDP and UDP takes the task of fragmenting and defragmenting the packet. Now, if I read through the feature list of eNet I see: Fragmentation and Reassembly ENet will send and deliver packets regardless of size. Large packets are fragmented into many smaller packets of suitable size, and reassembled on the foreign host to recover the original packet for delivery. The process is entirely transparent to the developer. Does this make sence? Why would one not leave it to UDP to do the "Fragmentation and Reassembly"? Thanks! Nathan

Share this post


Link to post
Share on other sites
UDP will fragment packets over the MTU value, HOWEVER, UDP packet reassembly isn't anything like TCP. Not only is it an all or nothing situation (all the pieces must be recieved the first time, there is no resending), but the driver can drop the partial fragments if the rest are not recieved in a short period of time. This means that under a laggy connections fragmented packets may always be lost.

Basically, fragmenting UDP packets can greatly increase the chance that they will be lost, so even if you have reliable UDP implimented, the bandwidth used and latency could increase exponentially if the MTU threshhold is passed by even 1 byte.

Share this post


Link to post
Share on other sites
Mmh .. ok. Thanks for your answers!
The point is, that in a game send "game-states" which are (occusionly) bigger than the mtu. If I am sure, that the game-state is only of use to me if it is complete I will leave the fragmentation to UDP. If a game-state is made of many "semi-states" which are usefull by themesellfs, it is a good Idea to make little "smaller than the mtu" packages.
Nathan

Share this post


Link to post
Share on other sites
If you are doing UDP I severely suggest using a 512 maximum byte boundary for your packets. Try spanning data over more packets if you need to.

Share this post


Link to post
Share on other sites
The reason I said the above is because routers and such along the route will also break up packets if they are too large. Just cuz your card can handle it doesn't mean recievers will allow it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this