本文介绍了LapTop中的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
有人知道如何获取笔记本电脑的IP地址吗?
我有一些代码可以很好地在我的计算机固定式上正常工作,但是在笔记本电脑中却无法正常工作
这是代码...
IPAddress [] IPAddr = DNS.GetHostByName(Dns.GetHostName()).AddressList;
字符串ip = IPAddr [1] .ToString();
谢谢大家...
Hi all,
Does anybody know how to get the IPAddress of the Laptop
I have a little code that works very well in my computer stationary, but it doesnt works in the Laptop
here is the code...
IPAddress [] IPAddr = DNS.GetHostByName(Dns.GetHostName()).AddressList;
string ip = IPAddr[1].ToString();
thank you all...
推荐答案
IPAddress[] IPAddr = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
for (int i = 0; i < IPAddr.Length; i++)
Console.WriteLine(IPAddr[i].ToString());
在我的笔记本电脑上,ipv4地址位于IPAddr[2]
On my laptop the ipv4 adress was on IPAddr[2]
fe80::b450:c989:5f9b:381c%12
fe80::108e:12d2:b281:ca66%17
192.168.0.178
2001:0:4137:9e74:108e:12d2:b281:ca66
是什么?
而且我的IP地址不存在...
what is it?
and my ip not exist there...
这篇关于LapTop中的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!