Advertisement

Should one leave fragmentation to UDP?

Started by August 01, 2005 12:47 PM
4 comments, last by Martin Piper 19 years, 6 months ago
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
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.
Advertisement
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
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.
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.
Path MTU Discovery
http://www.faqs.org/rfcs/rfc1191.html
-- Martin PiperReplicaNet Multiplayer Middlewarehttp://www.replicanet.com/

This topic is closed to new replies.

Advertisement