简体   繁体   English

C#如何通知客户端有关服务器动态IP更新的信息

[英]C# how to notify clients about server dynamic ip update

I have a chat application server running on a PC which has dynamic IP. 我有一台具有动态IP的PC上运行的聊天应用程序服务器。 nearly every hour it keeps changing. 它几乎每个小时都在变化。

how can i notify the users abt the changed IP? 我如何通知用户abt更改的IP?

In native code you can do this using NotifyIpInterfaceChange - not sure whether this is usable via P/Invoke, as it uses a callback. 在本机代码中,您可以使用NotifyIpInterfaceChange进行此操作-不确定是否可以通过P / Invoke使用它,因为它使用了回调。 This supports both IPV6 and IPV4. 这同时支持IPV6和IPV4。

You would then need to act appropriately to notify the users. 然后,您需要采取适当的措施来通知用户。

Prior to Windows Vista, the equivalent (IPV4 only) is NotifyAddrChange . 在Windows Vista之前,等效项(仅IPV4)是NotifyAddrChange

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM