is there a way to detect network connects and disconnects?

  • Thread starter Thread starter alexl
  • Start date Start date
A

alexl

hi, what is the way to detect ndis connects and disconnects in c#? In
native programs I think it's done with wmi

thx
 
alexl said:
hi, what is the way to detect ndis connects and disconnects in c#? In
native programs I think it's done with wmi

thx

You could probably p/invoke WSAAsyncSelect with FD_ADDRESS_LIST_CHANGE That
tells you whenever IP addresses are added and removed from your computer,
which usually happens on cable plug/unplug (or wireless association, or VPN
connect, etc).

WSAAsyncSelect is pretty simple to use and causes a message to be sent to
any Form or Control of your choice, which you can intercept by overriding
the WndProc method.
 
Back
Top