是否有当getifaddrs()业绩变动的通知机制? [英] Is there a notification mechanism for when getifaddrs() results change?

查看:139
本文介绍了是否有当getifaddrs()业绩变动的通知机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在启动时,我的程序调用getifaddrs()来找出网络接口,可用于连接本地IPv6组播。这工作尽可能去,但它不处理,其中一组可用的网络接口getifaddrs后的变化()返回的情况。

On startup, my program calls getifaddrs() to find out what network interfaces are available for link-local IPv6 multicasting. This works as far as it goes, but it doesn't handle the case where the set of available network interfaces changes after getifaddrs() has returned.

是否有某种方式在网络接口已经更改了操作系统来通知我的计划,这样我就可以再次调用getifaddrs()和更新我的名单?还是我注定要轮询getifaddrs()每隔几秒钟,永远不会消失?

Is there some way for the OS to notify my program when the network interfaces have changed, so I can call getifaddrs() again and update my list? Or am I doomed to poll getifaddrs() every few seconds, forever?

(注:在Windows上,我呼吁GetAdaptersAddresses(),而不是getifaddrs(),但同样的问题存在那里)

(Note: on Windows, I call GetAdaptersAddresses() instead of getifaddrs(), but the same issue exists there)

推荐答案

您可能想看看在NotifyAddrChange和NotifyIpInterfaceChange功能。

You probably want to have a look at the NotifyAddrChange and NotifyIpInterfaceChange functions.

这篇关于是否有当getifaddrs()业绩变动的通知机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆