System.IO.Pipelines Socket.ReceiveAsync(Socket, Memory<Byte>) vs PipeReader.Create(Socket.GetStream())

658 Views Asked by At

With System.IO.Pipelines you can read and parse data from a socket either by:

  • Creating a Pipe and filling it with a PipeWriter Task that directly receives from a socket with Socket.ReceiveAsync() and using another PipeReader Task to parse the data from the pipe.

OR

  • Use a PipeReader Task directly on the NetworkStream from the socket to parse the data directly from the stream with PipeReader.Create(new NetworkStream(Socket)))

Is one way more performant than the other, or is the performance difference negligible?

0

There are 0 best solutions below