views:

430

answers:

1

Hi there

I am searching for a method to be notified when any windows network interfaces go up or down or the addresses of any network interfaces are changed.

I would prefer solutions in C#, C is also possible. Winpcap could be used.

I am aware that there is an event for network adapter address changes in C#, but this also possible without enumerationg all adapters and looking the changed settings?

May some advanced programmer help a fellow newbie.

with best regards

+1  A: 

Have a look at the System.Net.NetworkInformation namespace. The NetworkChange class allows you to register for NetworkAddressChanged, and there are NetworkAvailability events and others that should cover most of what you're looking for. You will need to enumerate just like the sample shows- many machines have complex network setups that don't just boil down to "hey, something changed", so you'll need to set up the baseline before you start.

nitzmahone
Thanks, I will try that.
Emiswelt