宽带调制解调器IP地址 [英] BroadBand Modem Ip address

查看:106
本文介绍了宽带调制解调器IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用vb.net在Windows应用程序中获取宽带调制解调器IP地址.

How to get BroadBand Modem Ip address in Windows application using vb.net

推荐答案

转到此站点^ ],它将为您提供外部IP地址.
Go to this site http://www.whatismyip.com/[^] and it will give you your external IP address.


这取决于您要使用的地址:
如果要在网络上获取调制解调器的地址,则可以与之通信:
It depends on which address you want:
If you want the address of the modem on your network, so you can talk to it:
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection moc = mos.Get();
foreach (ManagementObject mo in moc)
    {
    string[] gateways = (string[])mo["DefaultIPGateway"];
    foreach (string gateway in gateways)
        {
        Console.WriteLine("Gateway: {0}", gateway);
        }
    }

您将需要添加对System.Management命名空间的引用
如果您想获取调制解调器用于与Internet进行通信的IP地址(即,您在访问站点时被呼叫的IP地址),则必须与Internet进行通信并获得响应-相当多少数几个网站会向您发送该信息-谷歌会找到您喜欢的网站.

You will need to add a reference to the System.Management namespace
If you want to get the IP address that the modem uses to talk to the Internet (i.e. the IP address that you get called when you are visiting a site) then you have to talk to the internet and get a response - there are quite a few sites which will send you back that information - google will find one you like.


这篇关于宽带调制解调器IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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