The problem i have is testing for a case where an internet connection is so choked that any normal browser will return an error when trying to access a webpage.
Livecode apps aside.. I see this in normal use, when uploading a video to vimeo for example.
While the upload is in progress, trying to access any webpage in any browser returns an error, as if i were trying to access a page that does not exist.
I assume this is because the connection is so choked with the video upload.
Now.. where my app is concerned.. Testing how the app handles this scenario reveals something unexpected to me.
First i test for an internet connection, each time the app tries to do it's thing, every 10 minutes.
Code: Select all
function internetConnectionTest
put URL "http://www.google.com" into tconnectionTest
put URL "http://www.yahoo.com" into tconnectionTestTwo
put "Starting checks..." into field "loaderMessage"
if tconnectionTest is empty and tconnectionTestTwo is empty then
return false
else
return true
end if
end internetConnectionTest
This always returns true if my connection is switched on (expected)
But.. the big.. But....
So my code knows we have a connection so continues onward to run a similar function....See comments in code....
Code: Select all
repeat with x = 1 to the number of items of pTheUrlArray
put item x of pTheUrlArray into tTheCurrentUrl
put item x of tEmailArray into tTheCurrentEmail
put "Checking " & truncateTheUrl(tTheCurrentUrl,20) into field "loaderMessage"
put URL tTheCurrentUrl into tWebsiteResponse
if tWebsiteResponse is empty then
// In the case of a choked connection tWebsiteResponse is always empty even though it passed the connection test millisecons ago.
else
// Never gets here with a choked connection.
end if
// and the code continues doing other stuff
So is there a better test i can to on the connection in stage 1...?
Kind regards
Gary