Improve networking performance
Networking can be made a lot faster and more clients can be handled. The idea is to use SocketAsyncEventArgs, pure TCP Socket and a custom lightweight buffered stream.
Resources: https://github.com/chronoxor/NetCoreServer/blob/master/source/NetCoreServer/TcpServer.cs https://www.codeproject.com/articles/83102/c-socketasynceventargs-high-performance-socket-cod https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socketasynceventargs?view=net-5.0#examples https://github.com/ObsidianMC/Obsidian/blob/experimental/Obsidian/Net/NetWriteStream.cs
Assigning myself for now
Note to self: keep an eye on https://github.com/dotnet/runtime/issues/49941 (.NET 7?)
I highly recommend checking out Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets as it already offers performant socket connections and listeners. It is used in ASP.NET Core so it must be 🚀
I don't think there is much difference between TcpListener and Sockets. TcpListener uses Sockets underneath it. https://www.codeproject.com/Articles/5270779/High-Performance-TCP-Client-Server-using-TCPListen After all the only thing we need is to accept series of bytes comming over network, the only thing we might be limited by is the serialization and deserialization of packets. Unless something in the source code was implemented incorrectly.
I still think just using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets is a better option, instead of going into the hassle of the needy greedy details of performant socket implementations.