Initializing a TCP server

Let's first create our TCP client, the same as we have with every application before, by creating a directory for it, and then using the CLI to create a console app:

dotnet new console -n SampleTcpClient

Then, within the same directory, we'll create our TCP server application with the same command:

dotnet new console -n SampleTcpServer

Now we're ready to start setting up our interactions. When we were last interacting directly with sockets exposing a port back in Chapter 8, Sockets and Ports, we were using Postman to generate HTTP requests against a given endpoint. Now, however, since we'll be writing our own TCP messages directly in code, we won't be constrained to processing the standardized HTTP headers generated ...

Get Hands-On Network Programming with C# and .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.