以编程方式更改IP地址 [英] Change the IP address programatically

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

问题描述

大家好,
有人知道如何在c#中以编程方式更改Ip地址吗?

Hi all,
does anybody knows how to change the Ip address programatically in c#?

推荐答案

为什么需要更改IP地址?

如果您已连接,则IP地址更改实际上将释放所有连接.有道理吗?

无论如何,您都可以使用Registry hacks:

http://www.codeguru.com/cpp/in/network/networkinformation/article. php/c2473 [ ^ ]

或者,您也可以查看使用WMI和C#配置TCP/IP设置 [ ^ ]

希望对您有帮助.
Why do you need to change IP address ?

In case you are connected your IP address change will actually release all the connections. Does it makes any sense ?

Anyway to do this you can use Registry hacks :

http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c2473[^]

Or you might also take a look into Configuring TCP/IP Settings using WMI and C#[^]

I hope this will help you.


哪个?
您的PC IP地址? AFAIK不能灵活地做到这一点,您必须与路由器(或其他DCHP服务器)交谈,而我所知道的是没有标准的处理方法.

您的互联网IP地址?取决于:如果它是静态IP,则不能.如果它是动态的,那么最简单的方法是重置路由器,并希望您的ISP为您提供一个新地址.确保您是唯一的用户,因为如果您在我忙的时候这样做会惹恼我,那么这会烦死我的.

为什么要这么做?
Which one?
Your PC IP address? AFAIK you can''t do it in a flexible manner, you have to talk to your router (or other DCHP server) and there is no standard way of doing that I am aware of.

Your internet IP address? Depends: if it is a static IP than you can''t. If it is dynamic then the easiest way is reset the router, and hope your ISP issues you a new address. Make sure you are the only user though as you would annoy the crap out of me if you did that while I was busy...

Why do you want to?


这篇关于以编程方式更改IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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