获取本机ip地址备忘

private static string getIpAddress()
        {
            var host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (var address in host.AddressList)
                if (address.AddressFamily == AddressFamily.InterNetwork)
                    return address.ToString();
            return null;
        }

 

你可能感兴趣的:(获取本机ip地址备忘)