In my Windows mobile application (written in C # with a compact framework), I need to know if any particular machine is active.
To achieve this, I thought of using the ping mechanism. I tried to use the Ping class implemented within opennetcf (the System.Net.NetworkInformation.Ping class for the .NET Framework is not part of the compact structure).
Since I pass the host name to the Ping.Send function, it first tries to resolve that host name and get the IP address.
But I observe the following problem: If the first dns resolution fails (because the network is currently not working), and if the application tries to send ping again, it also does not work, even if the network writes more. I check with a well-known network protocol analyzer, and I saw that only requests regarding the first dns resolution are sent. Requests for resolving the dns of the second ping are not sent.
Why is the second DNS query not sent? Is there any dns caching mechanism on such Windows Mobile devices? If so, can this mechanism be reset by software?
EDIT: I refused to find a solution for this DNS flush. I chose ping IP address instead of machine name. The problem with hardcoded IP verification is that we must be 100% sure that this IP address will not change. An IP gateway can be used because it is always available (if it is not, this means that the network is down).
source share