-
-
Everybody can use the method GetHostEntry of the DNS class inside .NET 2.0. But as far as I know, it does timeout only after 5 seconds, that is absolutely too much in an application context where you want to resolve multiple IP addresses.
Also, you might want to return the requested IP address instead of an exception.
That is why I build this little widget that is using asynchronous call to timeout the GetHostEntry method, and return the IP address in the case of a timeout.
private delegate IPHostEntry GetHostEntryHandler(string ip);
public string GetReverseDNS(string ip, int timeout)
{
try
{
GetHostEntryHandler callback = new GetHostEntryHandler(Dns.GetHostEntry);
IAsyncResult result = callback.BeginInvoke(ip,null,null);
if (result.AsyncWaitHandle.WaitOne(timeout, false))
{
return callback.EndInvoke(result).HostName;
}
else
{
return ip;
}
}
catch (Exception)
{
return ip;
}
}
-f.
-
-
A good article on MSDN
http://msdn.microsoft.com/en-us/library/ms143799.aspx
Greatly improved since SQL 2000...
-f.
-
-
Finally it's available! The Google web browser!
Some stats of Google Chrome compared to IE7:
RAM Usage : 128meg + 60/tab (150 + 50meg for IE7)
Speed: Extremely fast (better than Firefox) ?
Thread: Exactly the same number of thread
UI: Really simple UI
Startup : Half a second (7 second for the same page in IE7)
http://www.google.com/chrome
-f.