Fastest way to test internet connection

前端 未结 6 1678
别那么骄傲
别那么骄傲 2020-11-30 04:03

C# 2008 SP1

I am using this code to connect to our client website. This is for a softphone application. Before the user makes a call, the softphone has to test if th

6条回答
  •  失恋的感觉
    2020-11-30 04:36

    You can reference the Microsoft.VisualBasic.Devices namespace to use the NetworkAvailableEventHandler delegate and Network class. I use Network.IsAvailable property and Network.NetworkAvailabilityChanged event to check that the network is there (or is affected later), and then do an HTTP GET to my server to see if the server is there.

    This helps with reporting the issue a bit more specifically, instead of "can't see network".

提交回复
热议问题