Detecting network state (connected - disconnected) in C#

后端 未结 4 2206
南旧
南旧 2021-01-03 03:57

I am in need of a piece of code that can detect if a network connection is connected or disconnected. The connected state would mean a cable was plugged into the Ethernet co

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 04:31

    Call GetAdaptersInfo and loop through the list of available network adapters until you find the one you're looking for?

提交回复
热议问题