How can I detect if my system has received a new IP address?
My program reads all local IPs over DNS.GetHostAddress and binds a socket on each one. After a suspend, however, I cannot connect to my program.
Is there an event in System.Net to notify me when a system received a new IP address? My current idea for a workaround is an extra thread that checks the current interfaces.
You may want to use the System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged event.
Have a look here:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkchange.networkaddresschanged.aspx
Would be interesting to see if this works. Looks promising.
If not, you may want to poll every n seconds, not pretty but I doubt if n is a reasonable level, it will have much of a performance impact?