Hello people from wpcentral. Anyone know if it can recover the ( hostname/machine name ) with a local IP address ? I know that the resolution reverse 'hostname -> ip' works perfectly with `DeviceNetworkInformation.ResolveHostNameAsync (endpoint, OnNameResolved, null).`
Is it possible to do the same thing but in reverse? Given the IP of a Local Machine and retrieve its hostname? A thousand thanks
**Here is my code** , but it's doesn't work the host is always called **"192.168.1.5"** like the ip . And it's should return **"computer0001"**
Is it possible to do the same thing but in reverse? Given the IP of a Local Machine and retrieve its hostname? A thousand thanks
**Here is my code** , but it's doesn't work the host is always called **"192.168.1.5"** like the ip . And it's should return **"computer0001"**
Code:
DeviceNetworkInformation.ResolveHostNameAsync("192.168.1.5", OnNameResolved, null);
private void OnNameResolved(NameResolutionResult result)
{
IPEndPoint[] endpoints = result.IPEndPoints;
if (endpoints != null)
{
if (endpoints.Length > 0)
{
//Host always return ip adress and not the machine name
host = endpoints[0].ToString();
}
}
}