✅ [done] system.io.pipelines: unable to get last byte of what client has sent
i have a tcp server using the System.Net stuff, and it's just using the stream wrapper methods:
PipeReader.Create(ClientStream)
to obtain a PipeReader
i am having difficulty of getting the last byte of what a client has sent when i'm slicing stuff
notably, i can read the whole buffer in one fell swoop, but if i do this slice-and-advane dance, i'm unable to get at the last byte
code:
4 Replies
what exactly does it throw?
so, a couple things
- I would recommend using SequenceReader, it does a lot of the ugly work for you
- GetString has an overload that takes a ReadOnlySequence
and yeah, what does it throw @janetblackquill?
i figured out the issue; i was calling
reader.AdvanceTo
and consequently returning ownership of the buffer to it
but then after that i tried to read the bufferyou can use
/close