Problem with System.Net.Dns.GetHostEntry(dnsServer) on .NET 4.0
问题 I have been using the following code for months (without problem) in a .NET 2.0/3.5 environment: string server="192.168.1.3"; IPHostEntry ipe = System.Net.Dns.GetHostEntry(server); IPAddress ipa = ipe.AddressList[0]; IPEndPoint ipep = new IPEndPoint(ipa, (int)UdpServices.Domain); Here, server is hardcoded to an IP address, but in my application it could potentially be something like "server.test.com". When converting my project to .NET 4.0, this code stopped working when directly passing an