LapTop中的IP地址 [英] IPAddress in LapTop

查看:169
本文介绍了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...

推荐答案

它已经在那儿了,我认为对于不同的计算机,您的标准ip在哪个数组中是不同的(192.168. 1.1).

循环浏览,您会发现.

It is in there already,I think it is different from computer to computer what place in the array your standard ip is (192.168.1.1).

Loop through it and you will find.

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]


上.如果使用默认设置(使用DHCP),则笔记本电脑在实际使用之前没有IP地址连接到网络.如果在命令提示符下键入"ipconfig/all",则可以看到所有网络连接.这样,您就可以看到DNS是否可以为您提供任何服务.
If you are using the default setup (using DHCP), your laptop doesn''t have an IP address until it''s actually connected to a network. If you type "ipconfig /all" at a command prompt you can see all your network connections. That way, you can see if there is anything for DNS to give you.


这就是我所得到的...

Well thats what I got...

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地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆