AC.motion

August 06, 2006

Tuning packet size

A few days earlier I implemented the IP transport via UDP. Is that efficient? How many bytes do fit in one packet? I wouldn't want to create messages exceeding the size of one package (awkward handling, what if one of them gets lost etc.)!

So, with some help from the global database (aka Internet) I tried out different ping packets sizes (doing a binary search if you know what I mean: "512? higher! 768? lower! 640?...) and found 1.472 bytes is the maximum packet size before fragmentation occurs.

That's plenty even for serialized Java objects, and tons for custom binary encoded messages. Since always a whole packet gets sent size in this case doesn't really matter, as long as the payload is less or equal 1.472 bytes. What I don't know - if the payload is less than 1.472 bytes, does the packet shrink to fit?!

0 Comments:

Post a Comment

<< Home