From 3831f512218c733860624346b63684886766236a Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Wed, 15 May 2024 19:32:34 -0700 Subject: [PATCH] default to InterNetworkV6 for socket client --- src/SuperSocket.Client/SocketConnector.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SuperSocket.Client/SocketConnector.cs b/src/SuperSocket.Client/SocketConnector.cs index 7457b4be4..b2143e698 100644 --- a/src/SuperSocket.Client/SocketConnector.cs +++ b/src/SuperSocket.Client/SocketConnector.cs @@ -24,7 +24,12 @@ public SocketConnector(IPEndPoint localEndPoint) protected override async ValueTask ConnectAsync(EndPoint remoteEndPoint, ConnectState state, CancellationToken cancellationToken) { - var socket = new Socket(remoteEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + var addressFamily = remoteEndPoint.AddressFamily; + + if (addressFamily == AddressFamily.Unspecified) + addressFamily = AddressFamily.InterNetworkV6; + + var socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp); try {