Now it turns out that if the search returns file descriptions, we may easily end up with fragmented IP packets. This is because a file description result is around 100 bytes (estimated with ethereal traces) each and 50 of them gives around 5 kB of data. With a compression of 30 - 50 % (estimated with ethereal traces) this gives us a packet size of 2500 - 3500 bytes wich is greater than the MTU size of 1500 bytes. Result is that each packet containing file description results will be split in atleast two IP packets.
My suggestion is that instead of using a fixed limit of 50 results, force a send when the bytes in the packet exceed the MTU when a 40% compression ratio assumed.
Eg.
... uint32 uLen = sizeof(byPacket)-byIO.GetAvailable(); if (uLen + 100 > 2500) { ... CKademlia::GetUDPListener()->SendPacket(byPacket, uLen, uIP, uPort); ... } ...
/netfinity