Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 776
reza Avatar asked May 03 '12 18:05

reza


2 Answers

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.

like image 173
wdscxsj Avatar answered Nov 15 '22 04:11

wdscxsj


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

like image 43
Styxxy Avatar answered Nov 15 '22 05:11

Styxxy