Using pipelines for content streaming
System.IO.Pipelines
is a high-performance I/O .NET library that was first shipped with .NET Core 2.1 and was born from performance work carried out by the Kestrel team. The purpose behind pipelines is to reduce the complexity of correctly parsing stream and socket data.
In this section, we will learn how to use pipelines with sockets. We will write to small console applications. The first console application will listen for incoming requests on port 7000
and output the contents to the console window. The second console application will listen for the newline key. When it is detected, it will send the contents of the command line to the server on port 7000
. By completing this project, you will see how easy it is to write a network communication application with a minimal number of lines of code using pipes and sockets.
Let’s start by writing our server console app.
Writing and running a TCP server console application
In this section...