My PC is connected to a LAN which gateway is 80.0.0.1 When I use this code:
IPHostEntry hostEntry = Dns.GetHostEntry("80.0.0.1");
Var name = hostEntry.HostName;
it gives me the name of a global Internet domain (hari-core-2a-xe-800-0.network.virginmedia.net), not the name of my local host. How can I get the right name of the local host. I know that there are reserved domains like 10.0.x.x that can be used with LANs, but I don't want to change the LAN gateway. If I can change it in my LAN, I can't force all users of my application to change theirs if they have similar conflictions. Is there any work around?
Edit: I changed the LAN to 9.0.0.1 for testing. Dns.GetHostEntry threw "No such host is known" exception. It fails to get the name of the AP. and android devices connected to the LAN. Any solution? Note: Advanced IP Scanner also can't get the names of the devices. It displays tha IP ot each device as a name.
The solution that works for me:
You can find the code (C# & VB.NET) in the PingThread Class in the IPScanner Applicationm here: http://www.mediafire.com/file/1fku7fz7ytr8p59/IPScanner.zip