如何获得3G调制解调器的IP地址? [英] How can i get IP Address of my 3G modem?
问题描述
我的GPRS调制解调器有一张SIM卡.它可以连接Web. Web服务给它一个ip号码.我需要它.像这样: http://www.your-ip-address.com/ >
我该怎么做C#?
您可以使用以下代码通过DNS获得IP地址列表:
var name = Dns.GetHostName();
var entry = Dns.GetHostEntry(name);
foreach (var address in entry.AddressList) {
Console.WriteLine(address);
}
如果要将IP地址作为硬件的属性,则可以使用名称为Win32_NetworkAdapterConfiguration
的System.Management.ManagementClass
.请参阅 http://msdn.microsoft.com/en-us /library/system.management.managementclass.aspx 了解详情.
My GPRS modem has got a sim card. it can connect Web. Web service give it a ip number. i need it. like that: http://www.your-ip-address.com/
How can i do that C#?
You can get a list of your IP addresses via DNS using the following code:
var name = Dns.GetHostName();
var entry = Dns.GetHostEntry(name);
foreach (var address in entry.AddressList) {
Console.WriteLine(address);
}
If you want the IP address as a property of the hardware, you can use the System.Management.ManagementClass
with the name Win32_NetworkAdapterConfiguration
. See http://msdn.microsoft.com/en-us/library/system.management.managementclass.aspx for details.
这篇关于如何获得3G调制解调器的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!