How do you determine if an Internet connection is available for your WinForms App?

前端 未结 8 863
生来不讨喜
生来不讨喜 2020-12-24 15:33

What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions

8条回答
  •  Happy的楠姐
    2020-12-24 16:14

    InternetGetConnected state is step one in establishing that you are connected to a network. In order to determine if you have an internet connection one technique is to use the IPHelper api to send an ARP (address resolution protocol) request for some server on the internet.

提交回复
热议问题