Here's a piece of code I'm using:
public void Start() {
Dns.BeginGetHostEntry("www.google.com", new AsyncCallback(Stop), "Lookin up Google");
}
public void Stop(IAsyncResult ar) {
IPHostEntry ie = Dns.EndGetHostEntry(ar);
Console.WriteLine(ie.HostName);
foreach(string adres in ie.Aliases) {
Console.WriteLine(adres);
}
}
And it returns nothing. It doesn't seem to work and I get no errors.
If I use the non-asynchronous methode: Dns.GetHostEntry("www.google.com");
, that does work.
I don't get what's wrong here.