I'm able to ping 254 devices and get result back for their round trip time between 3-4 seconds. I'm using ThreadPool and it works great.
I have collected all devices IP addresses and keeping records of those that have gotten a round trip values and those that have failed; so I can filter out the IP address that never got back their round trip from ping.
Given a collection of set good IP address; I can collect DNS values for each IP address; I have used everything but it takes 45 secods to over 1 minute to get back some DNS values from those set of good IP addresses.
I have use this code; this is very slooooow
IPHostEntry ipHostEntry = Dns.GetHostByAddress(IPAddress.Parse(IP));
then I use this code below; it is better at best using ThreadPool but nevertheless it takes 45 secods to 1+ minute.
private delegate IPHostEntry GetHostEntryHandler(string ip);
public string ReverseDNS(string ip, int timeout) // timeout in milliseconds
GetHostEntryHandler callback = new GetHostEntryHandler(Dns.GetHostEntry);
IAsyncResult result = callback.BeginInvoke(ip, null, null);
if (result.AsyncWaitHandle.WaitOne(timeout, false))
// Received response within timeout limit
// Did not receive response within timeout limit,
// send back IP Address instead of hostname
// Error occurred, send back IP Address instead of hostname
I run a comparison to a tool that I found Si360 scanning the same 254 devices as on my test program; SI260 took 9 seconds to get response back resolve all DNS values whenever possible.
Is it anything that I'm missing to get a faster response on converting IP address to DNS.
Your help would be much appreciated.