RevenantX / LiteNetLib

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

Is there a way to get bytes[] w/o packet overhead stuff from NetDataReader? #543

Closed yosimba2000 closed 7 months ago

yosimba2000 commented 7 months ago

So with NetDataWriter.Put( ) , instead of tossing in a string as an argument, I want to toss in a byte array using NetDataWriter.Put(byte[ ] ).

Not sure if this does what I want, but I see that it's supported as an overload.

Then on NetDataReader, I want to retrieve just the byte array I sent, but the only one that returns anything is NetDataReader.RawData. However, the result is much larger than the input array, which I think is because it's grabbing packet overhead data as well.

Is there a way to just grab my original byte array?

RevenantX commented 7 months ago

@yosimba2000 you can use for Send methods that accept just byte array - this will be less overhead. For receive you can use NetDataReader.RawData in combination with NetDataReader.UserDataOffset and NetDataReader.UserDataSize

RevenantX commented 7 months ago

@yosimba2000 also better use discord channel (on README page) for questions