Connected to the Internet

I’m using a URL Socket to authenticate a user’s activation to an app.
If the network is down, they have to wait a long time to find out that it failed.
Is there a way to determine if the computer’s network interface is live?

Public Function IsInternetConnected() as Boolean
  ' checks if internet is connected by checking the connection to google,apple and microsoft
  ' fastest way found today
  ' see https://forum.xojo.com/36891-best-way-to-determine-internet-connection-vote-advice
  
  Dim http As New TCPSocket
  
  http.Address = "www.apple.com"
  http.port = 80
  http.Connect
  dim okapple as Boolean = (http.LastErrorCode = 0)
  http.close
  
  http.Address = "www.google.com"
  http.Connect
  dim okgoogle as Boolean = (http.LastErrorCode = 0)
  http.close
  
  http.Address = "www.microsoft.com"
  http.Connect
  dim okmicrosoft as Boolean = (http.LastErrorCode = 0)
  http.close
  
  Return okapple and okgoogle and okmicrosoft
  
End Function

since writing this, I just found system.network.isConnected built into Xojo. It appears to work fine. Is there a down-side?

PS: how have I never seen this before?

don’t know, but does it check for network only, or also for internet access ?

I don’t know the answer to that.

It does not, was just about to tell you that’s the downside.

good to know.

it basically tells you, on iOS , the radios are powered up and appear to be connected but tells you nothing about the reachability of a given site which can be affected by DNS issues router issues etc etc