reza
reza

Reputation: 6358

How detect a MS Windows IP address change without polling

I am looking for a way to, without polling, to get a notification when the Windows machine IP address change. I need to react to this change and perform some action in my application.

Anyone has done anything of the sort?

Upvotes: 8

Views: 4274

Answers (2)

wdscxsj
wdscxsj

Reputation: 860

You can use NotifyAddrChange() to handle IPv4 address change. The linked page has a succinct demo. NotifyIpInterfaceChange() handles both IPv4 and IPv6 (separately or simultaneously -- see the doc), but requires Vista or later.

Upvotes: 6

Styxxy
Styxxy

Reputation: 7517

If you are using .NET, you can implement the NetworkChange::NetworkAddressChanged Event. I believe that provides exactly what you want.

Upvotes: 2

Related Questions