RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.07k stars 496 forks source link

How to turn off packets merging? #434

Closed joshua-light closed 3 years ago

joshua-light commented 3 years ago

Hi!

I'm testing different RUDP libraries, and LiteNetLib is one of them. For example, I've tried to check how many packets per second one can handle. However, I've found that the number is way too small. After some debugging, seems like that's because all packets are automatically merged. In my case, packets have a size of 64 bytes and hence 21 of them are batched into 1.

Is there any way to turn off automatic merging?

RevenantX commented 3 years ago

@JoshuaLight packet merging cannot be disabled using some bool. You can remove this logic from code - but this doesn't have any big sense. Unreliable Packet's per second count will be close to simple C# Socket usage (but if you enable native mode in LiteNetLib it will be better).

Also there is already some benchmarks - https://github.com/JohannesDeml/NetworkBenchmarkDotNet (but it doesn't use native mode) But they in 95% cases doesn't have any sense because "packets per second" is hardware dependent and you will have lags in your game logic more than network layer.

RevenantX commented 3 years ago

@JoshuaLight also merging isn't a problem here. If you need tons of Reliable packets per second just use TCP.

joshua-light commented 3 years ago

Thanks a lot for the info! I think this issue can be closed.