Does libuv have a mechanism to notify the program when the host machine's network interfaces change?

158 views
Skip to first unread message

Jeremy Friesner

unread,
Mar 9, 2018, 2:03:24 AM3/9/18
to libuv
Hi all,

I see that libuv has a function uv_interface_addresses() that returns a list of uv_interface_address_t structures describing the state of the network interfaces attached to the machine, which is good.

My question is, is there any mechanism in libuv that will call a notification-callback so that my program will know when the computer's network interfaces have changed (i.e. when an interface has come online, gone offline, had its IP address change, etc)?   With that I could then call uv_interface_addresses() again to see the new state of things, and update my program's behavior as necessary.

Thanks,
Jeremy

Santiago Gimeno

unread,
Mar 9, 2018, 7:38:58 AM3/9/18
to li...@googlegroups.com
Hi Jeremy,

No, there's not. I think it could be implemented on linux using the NETLINK_ROUTE netlink family and on Windows maybe with the NotifyAddrChange function [2].

[1]: http://man7.org/linux/man-pages/man7/rtnetlink.7.html
[2]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366329(v=vs.85).aspx.

Best regards,

Santi

--
You received this message because you are subscribed to the Google Groups "libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libuv+unsubscribe@googlegroups.com.
To post to this group, send email to li...@googlegroups.com.
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Nathan Hartman

unread,
Dec 20, 2018, 3:24:57 PM12/20/18
to libuv
On Friday, March 9, 2018 at 7:38:58 AM UTC-5, Santiago Gimeno wrote:
Hi Jeremy,

No, there's not. I think it could be implemented on linux using the NETLINK_ROUTE netlink family and on Windows maybe with the NotifyAddrChange function [2].

[1]: http://man7.org/linux/man-pages/man7/rtnetlink.7.html
[2]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366329(v=vs.85).aspx.


If I understand correctly, NotifyAddrChange() will only be useful for IPv4 interfaces.

To get notifications for changes to IPv4 and IPv6 interfaces on Windows Vista and later, see NotifyIpInterfaceChange().

Reference:

I don't know about Linux or other OSes unfortunately.

Reply all
Reply to author
Forward
0 new messages