Is there any API in .Net to find whether the network cable is plugged / Unplugged?
Thanks in advance.
Printable View
Is there any API in .Net to find whether the network cable is plugged / Unplugged?
Thanks in advance.
no there isnt,
you can use WMI to retrieve the IP address, if it fails that means the cable is not plugged in.
Hi Kovan,
I am really battling with this! Could you send me a code example please?
Much appreciated.
read this, good info
http://www.developersdex.com/asp/mes...2Ephx%2Egbl%3E
this should work, but its dirty and it requires WMI calls (which are slow most of the times, and the documentation is very very poor for WMI)
I will try to dig up how i implemented this, but i think mine was dirtier than anything, from what i vaguely remember, i would check IP address of a network connection, if it failed(threw exception) it was because network cable was not plugged, and if it was plugged it would either return nothing or the actual IP