How detect a MS Windows IP address change without polling

networking, windows

Solution

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.

Problem

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?

Original source