0

I have used this code but same ipv4 address are stored where IP address and location etc. are difference of each machine. please check

public static string GetLocalIPAddress()
    {
        var host = Dns.GetHostEntry(Dns.GetHostName());
        foreach (var ip in host.AddressList)
        {
            if (ip.AddressFamily == AddressFamily.InterNetwork)
            {
                return ip.ToString();
            }
        }
        throw new Exception("Local IP Address Not Found!");
    }
Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0