How to flush DNS cache in Windows Mobile programmatically?
Posted
by Bounded
on Stack Overflow
See other posts from Stack Overflow
or by Bounded
Published on 2010-04-01T13:52:02Z
Indexed on
2010/04/02
8:23 UTC
Read the original article
Hit count: 311
Hello,
My windows mobile application (written in C# with the compact framework) needs to know if a particular machine is active or not.
To achieve this goal, I thought to use a ping mechanism. I tried to use the Ping class implemented in the opennetcf framework (the System.Net.NetworkInformation.Ping class for the .NET Framework is not part of the compact framework).
Because I give to the Ping.Send function a host name, it first tries to resolve this host name and to retrieve an IP address.
But i observe the following problem : If the first dns resolution fails (because the network is down at this moment), and if the application tries immediately again to send the ping, it fails too, even if the network is note down anymore. I check with a famous network protocol analyzer and i saw that only the requests concerning the first dns resolution are sent. The requests concerning the dns resolution of the second ping are not sent.
Why is the second dns request not sent ? Is there any dns cache mechanism on such Windows Mobile devices ? If yes, can this mechanism beeing flushed programmatically ?
EDIT : I gave up finding a solution to this DNS flush. I chose to ping an IP adress instead of a name machine. The problem of pinging an hard coded adress IP is that we have to be 100% sure that this IP will not change. The gateway IP can be used because it's always reachable (if it does not, it means the network is down).
© Stack Overflow or respective owner