C
C#2y ago
JMK

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?
ConnectionHandler Class (Microsoft.AspNetCore.Connections)
Represents an endpoint that multiple connections connect to. For HTTP, endpoints are URLs, for non-HTTP it can be a TCP listener (or similar).
2 Replies
JMK
JMKOP2y ago
GitHub
MultiProtocolAspNetCore/MyEchoConnectionHandler.cs at master · davi...
Contribute to davidfowl/MultiProtocolAspNetCore development by creating an account on GitHub.
JMK
JMKOP2y ago
Figured out my problem. Scoping dependencies with IScopeFactory fixed this issue.
Want results from more Discord servers?
Add your server