Skip to content

WebSocket ability to force IPv6 or IPv4 #45462

@xinbingyiran

Description

@xinbingyiran

UPDATE: Scoped to WebSocket only as there is no way to achieve that.
HttpClient has a way and HttpWebRequest is legacy API (so no need).


I find the sulution for httpclient from issues like this.

var handler = new SocketsHttpHandler{
   ConnectCallback = async (context,token)=>{
      // dns get ipv6 and connect
      return ipv6stream
   }
};
var client = new HttpClient(handler);// HttpClientHandle???

but it can useful for httpclient only,and it replaced httpclienthandle,will lost the diagnosticsHandler yet.

and I view the httpwebrequest and websocket source code, the SocketsHttpHandler is a private member of them only,and i can't get the ConnectCallback for using.

so how can i force ipv6 or ipv4 on httpwebrequest, websocket and httpclient(with diagnosticsHandler )

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.Net

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions