Is it really impossible to read from stream while it is being written? I got this code that writes bytes to dstStream, the problem is that I cannot read from it while it is being written. Is there any way to circumvent this limitation?
Edit: Just a clarification: The stream is an Audio stream that I need to process in Real-Time. Is there a way to "republish" a real-time stream?
var srcStream = await Request.Content.ReadAsStreamAsync();
var dstStream = new MemoryStream();
var buffer = new byte[4096];
int bytesRead;
while ((bytesRead = await srcStream.ReadAsync(buffer, 0, buffer.Length, token).ConfigureAwait(false)) != 0)
{
await dstStream.WriteAsync(buffer, 0, bytesRead, token).ConfigureAwait(false);
}