Page 1 of 1

Method of detecting a valid internet connection

Posted: Wed Mar 30, 2011 2:07 pm
by reelstuff
I am looking to see if there is a method of determining a valid connection to the internet. (desktop app)

Since, I have content I want to display inside an app, if there is a connection, however if there is no connection I need to be able to show default content in place of live content.

This is so that there would be no content issues or perhaps say a 404 or other error code.

I suppose that you could ping a URL and determine if there is a valid status code, HTTP Status Codes 200 would indicate a valid internet connection.

someone else posted about detecting an iOS connection to wifi, I wonder if you could do the same thing in iOS?

Any thought, suggestions, ect, thanks in advance.

Re: Method of detecting a valid internet connection

Posted: Wed Mar 30, 2011 6:38 pm
by Dixie
Hi...

This function was posted by Mark Schonewille some time ago..

Code: Select all

function connectionAlive
  put "255.255.255.255:44444" into mySock
  open datagram socket to mySock
  put hostAddress(mySock) into myIP1
  close socket mySock
  if myIP1 is "127.0.0.1" then
    return false
  else
    return true
  end if
end connectionAlive
Hope it helps.. it helped me !

be well

Dixie