Skip to content

Commit 3831f51

Browse files
committed
default to InterNetworkV6 for socket client
1 parent 9b5279e commit 3831f51

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/SuperSocket.Client/SocketConnector.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ public SocketConnector(IPEndPoint localEndPoint)
2424

2525
protected override async ValueTask<ConnectState> ConnectAsync(EndPoint remoteEndPoint, ConnectState state, CancellationToken cancellationToken)
2626
{
27-
var socket = new Socket(remoteEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
27+
var addressFamily = remoteEndPoint.AddressFamily;
28+
29+
if (addressFamily == AddressFamily.Unspecified)
30+
addressFamily = AddressFamily.InterNetworkV6;
31+
32+
var socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp);
2833

2934
try
3035
{

0 commit comments

Comments
 (0)