LiteNetLib icon indicating copy to clipboard operation
LiteNetLib copied to clipboard

About Packet Fragmentation

Open DenizYunus opened this issue 2 years ago • 1 comments

Automatic small packets merging Automatic fragmentation of reliable packets Automatic MTU detection

Regarding these 3 features I switched from my fragmentation and reassembling UDP package mechanism to this library. But I couldn't see the automatic part of the library in the example. I want to send a kinda big chunk of data (a texture, with dynamic resolution). Can you provide an example script? Thank you.

Edit: I forgot to add that when I try to send all the package in Send function thinking it parses automatically, it gave me "The output byte buffer is too small to contain the encoded data, encoding 'Unicode (UTF-8)' fallback 'System.Text.EncoderExceptionFallback'."

DenizYunus avatar Jul 25 '24 17:07 DenizYunus

@DenizYunus it works automatically when you use ReliableOrdered or ReliableUnordered messages. Just send large byte array - and you will receive it as one large packet Don't use text for this. Use PutBytesWithLength or just PutBytes and get length from NetPacketReader.UserDataSize Also for questions better use Discord chat https://discord.gg/FATFPdy

RevenantX avatar Jul 27 '24 21:07 RevenantX