How to determine the IP address of MS Windows without polling

I am looking for a way, without polling, to receive a notification when a Windows IP address changes. I need to respond to this change and perform some actions in my application.

Has anyone done something like this?

+6
source share
2 answers

You can use NotifyAddrChange() to handle an IPv4 address change. There is a short demo on the linked page. NotifyIpInterfaceChange() handles both IPv4 and IPv6 (separately or simultaneously - see the document), but requires Vista or later.

+3
source

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

+2
source

Source: https://habr.com/ru/post/914833/


All Articles