C#调用本地ipv4 ip地址,若计算机在局域网内,那么将调用的是局域网ip,
- using System.Net;
- using System.Net.Sockets;
- string name = Dns.GetHostName();
- IPAddress[] ipadrlist = Dns.GetHostAddresses(name);
- foreach (IPAddress ipa in ipadrlist)
- {
- if (ipa.AddressFamily == AddressFamily.InterNetwork)
- label1.Text=(ipa.ToString());
- }
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
文章评论 本文章有个评论