I am using the below Async method to get response from the server. The response I get from the server varies from 1200 to 1500 bytes based on the request type. So, I can't fix the size of the buffer.
Is there any way from SslStream.ReadAsync
to get the length of the original bytes received?
byte[] Buffer = new byte[1500];
await _sslStream.ReadAsync(Buffer, 0, Buffer.Length);
I tried using the below code but getting an exception saying:
This stream don't support seek operations.
await _sslStream.ReadAsync(Buffer, 0, (int)_sslStream.Length);
Earlier, I used BeginRead
/ EndRead
. With that I get the original size of the buffer but Async await looks cleaner. So, I wanted to check whether its possible to get the length using ReadAsync
.