开发者

How to monitor Ethernet connection status

开发者 https://www.devze.com 2023-01-19 19:57 出处:网络
How can I monitor if Ethernet cables are plugged in or not from .NET for a given Ethernet connection?

How can I monitor if Ethernet cables are plugged in or not from .NET for a given Ethernet connection?

I would like to enumerate all Ethernet connections and subscribe to any connection status changes. I am not interested in detecting Internet access, only if an Ethernet connection is Connected or Not Connected.

开发者_运维百科

Update: I found this blog post on how to use a WMI query to be notified of disconnections.


Look at the NetConnectionStatus property of the Win32_NetworkAdapter class.

0

精彩评论

暂无评论...
验证码 换一张
取 消