Network System.Net.Dns.GetHostByAddress is too slow
-
Hello, I have an app that I use to get poll for the hostnames on my local network. I use this method to get the information. System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByAddress(address); The problem is that when GetHostByAddress(...) fails because there is no machine at a given IP address, it throws an exception that takes a long time (a few seconds). Is there a faster method to call? Is there a method that does the same thing, but sets an error value instead of throws an exception when a bad thing occurs? Is there some kind of timeout setting that I can set to like 20 milliseconds? (I can be assured of always being on a lan with a fast response) I use a whole bunch of threads to speed up the application, which makes the wait more tolerable, but it still takes way too long for my taste. Is there a better method to use in .Net 2.0 Thanks.
-
Hello, I have an app that I use to get poll for the hostnames on my local network. I use this method to get the information. System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByAddress(address); The problem is that when GetHostByAddress(...) fails because there is no machine at a given IP address, it throws an exception that takes a long time (a few seconds). Is there a faster method to call? Is there a method that does the same thing, but sets an error value instead of throws an exception when a bad thing occurs? Is there some kind of timeout setting that I can set to like 20 milliseconds? (I can be assured of always being on a lan with a fast response) I use a whole bunch of threads to speed up the application, which makes the wait more tolerable, but it still takes way too long for my taste. Is there a better method to use in .Net 2.0 Thanks.