I'm writing a program that needs to be aware of all IP addresses a machine and the packets are transfered through their connections. I can get the IP list before running of the main program with 开发者_如何转开发"gethostbyname", but what if any IP is available after that? Well having a loop with let say 1 minute sleep for each iteration and updating the IP list can help me but it's not accurate and I may lose some of the packages! Is there any other way? I'm using Windows and C++
Thanks
Not sure on your actual requirements but I would start by calling
NotifyIpInterfaceChange
which is part of the IPHelper API
http://msdn.microsoft.com/en-us/library/aa814450(v=VS.85).aspx
精彩评论