Closed
Description
Is your feature request related to a problem? Please describe.
We should make it so you don't have to resort to something like the following to access the managed Socket if you really want to.
var socket = (Socket)connectionContext.GetType().GetField("_socket", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(connectionContext);
Proposed API
using System.Net.Sockets;
namespace Microsoft.AspNetCore.Connections.Features
{
+ public interface IConnectionSocketFeature
+ {
+ Socket? Socket { get; }
+ }
}
Usage Examples
var socket = connectionContext.Features.Get<IConnectionSocketFeature>().Socket;
Metadata
Metadata
Assignees
Labels
This issue impacts very few customersAPI was approved in API review, it can be implementedIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsThis issue represents an ask for new feature or an enhancement to an existing oneUp for grabs. We would accept a PR to help resolve this issueThis label is used by an internal tool