如何找出哪个IP地址是活动ip? [英] How to find out which ip address is active ip ?

查看:124
本文介绍了如何找出哪个IP地址是活动ip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在使用此代码获取本地网络中当前计算机的IP地址:

i'm using this code to get ip address of current machine in the local network :


IPHostEntry ips = Dns.GetHostByName(Dns.GetHostName());
      foreach (IPAddress ip in ips.AddressList)
        this.txtMessages.Text += ip.ToString() + "\r\n";

推荐答案

有人可以帮帮我吗?

can anybody help me ?

不,不是真的。只有本地网络中的见证人才能告诉您使用的IP。因为只有这样的见证人才能告诉你离开你机器的数据包是否被路由到这个网络。

No, not really. Only a witness in the local network can tell you what IP is used. Because only such a witness can tell you whether a packet leaving your machine is routed into this network or not.

你唯一能做的就是:当他们离开第3层时检查你所有的传出数据包然后你可以通过实际的IP使用来判断它。

The only thing you can do: Inspect all your outgoing packets when they leave layer 3. Then you can tell it by actual IP usage.


这篇关于如何找出哪个IP地址是活动ip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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