davidfowl / BedrockFramework

High performance, low level networking APIs for building custom servers and clients.
MIT License
1.07k stars 155 forks source link

Is Bedrock production ready? #157

Closed AachoLoya closed 2 years ago

AachoLoya commented 2 years ago

https://github.com/davidfowl/BedrockFramework/blob/main/samples/ServerApplication/EchoServerApplication.cs

This sample is almost 3 years old. Wondering if things have changed now in ASP.NET 7 or can I still use this TCP sample? Is it production ready?

Another concern I have with TCP Echo Server is how to handle "Fast Producer, Slow Consumer" problem. Is there a way to limit buffered data being received from client until client consumes all the data that's being sent back? Example, I'd like to limit it to 32KB pending, if client hasn't read all data being sent back, then server shouldn't read anymore from client.

AachoLoya commented 2 years ago

https://learn.microsoft.com/en-us/dotnet/api/system.io.pipelines.pipereader.copytoasync

Asynchronously reads the bytes from the PipeReader and writes them to the specified PipeWriter, using a specified buffer size and cancellation token.

How do I specify Buffer size?