Use Dns.GetHostAddresses in Socket.Connect (dotnet/corefx#37324)
authordudu <dudu@cnblogs.com>
Wed, 1 May 2019 15:10:57 +0000 (23:10 +0800)
committerStephen Toub <stoub@microsoft.com>
Wed, 1 May 2019 15:10:57 +0000 (11:10 -0400)
Replace Dns.GetHostAddressesAsync with Dns.GetHostAddresses in Socket.Connect

Commit migrated from https://github.com/dotnet/corefx/commit/787f87fc781ca1f42d69b27576db0c9dce913700

src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs

index 7d04f74..acb5405 100644 (file)
@@ -899,7 +899,7 @@ namespace System.Net.Sockets
             }
             else
             {
-                IPAddress[] addresses = Dns.GetHostAddressesAsync(host).GetAwaiter().GetResult();
+                IPAddress[] addresses = Dns.GetHostAddresses(host);
                 Connect(addresses, port);
             }