JMK
JMK
CC#
Created by JMK on 2/13/2023 in #help
ASP.NET Core ConnectionHandler - custom protocol, TCP as transport
Hey C#. I'm trying to use ConnectionHandler https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.connections.connectionhandler?view=aspnetcore-2.2 because a PLC connecting to my webserver has horrible support for HTTP. However I'm seeing a problem where I connect two TCP clients from same host to the server. The connection is reset by peer (which I guess is the server). I can see that OnConnectedAsync should return a task that represents the connection lifetime. The TCP connections are gonna be long-lived, so should I place the task in a thread, or run it in Task.Run?
3 replies