system.Net.Dns.GetHostAddresses hangs RRS feed

  • Question

  • foreach(string computerName in listComputerNames)
        System.Net.IPAdress[] ipArray = System.Net.Dns.GetHostAddress(computerName);
        myIp = ipArray[0].ToString();

    I have the above basic code but it often hangs very quickly when going through a large list of computers.  I have done similar code in PowerShell without issue.

    The DNS server appears to be responsive when manually queried so I am wondering what I am doing wrong?

    I even put the above code in a worker thread and retried the query if it took more than 3 seconds to complete.  It still hangs.



    • Moved by Bob Shen Monday, December 17, 2012 3:37 AM (From:Visual C# General)
    Tuesday, December 11, 2012 2:54 AM


All replies