Updated on Kisan Patel
If you have an IP address and you need to resolve its hostname then use the Dns.GetHostEntry
method in C#.
Namespace:
using System.Net;
Program
class Program { static void Main(string[] args) { IPHostEntry iphost = Dns.GetHostEntry("127.0.0.1"); string hostName = iphost.HostName; // Print out name. Console.WriteLine(hostName); Console.ReadKey(); } }
Output of the above program…