MemoryStream, as I subsequently want to parse that using CborReader (unfortunately I didn't find any way getting the CborReader itself to read the data directly from the socket).MemoryStream. My tests indicate that I can't rely solely on NetworkStream.DataAvailable but also need to call Socket.Poll(), so I've come up with the following code: