I have a dated game server with typical TCP packet protocol (length / type / data[length]), and my task is to find modern frameworks to rewrite it in.
Having written a (small) RESTish API in ASP.NET Core 2.1, I know that it provides DI / logging / configuration features which could perfectly replace similar functionality in the old server. I thought I could use ASP.NET Core, making it handle said TCP packets instead of HTTP requests.
Now I'm a bit stuck in where to start and if / how it would fit into ASP.NET Core. So far I've RTFM'ed about inner ASP.NET Core workings and found some things that confused me:
ConnectionHandler
, but I can't see, for example, where it starts a TcpListener
to accept new continuous connections with clients.IHostedService
or BackgroundService
to do all TCP communication in.To sum it up, my research resulted in the following two questions:
After getting back to this, I realized that Project Bedrock is aiming to further generalize Kestrel to support completely custom protocols, not even limited to raw TCP. An overview / description can be found here.
The link above shows the current public state of the project on the GitHub repository with great practical examples. It seems to be planned to be integrated with whatever follows the ASP.NET Core roadmap for .NET 6, but a prerelease version compatible with .NET Core 3.1 is available and works great in my experiments. The functionality in question no longer seems to be on the roadmap.