Interrupting a PUT URL or POST TO URL
Posted: Tue Feb 16, 2016 4:38 am
I'm writing an app that communicates with an online database.
At one point I'm using the following to check whether the mobile device is able to connect to the internet -
put URL "http://www.google.com" into ccConnCheck
if ccConnCheck is empty then...
At another point I'm using the following to check whether the mobile device is able to make contact with my online database -
post "" to URL "http://mywebsite.com/mywebsite-test-status.php"
put it into ccResponse
If ccResponse <> "Status=Received" then...
Where there is some PhP set up at the other end to respond to the POST.
It all "works", but I'm finding that there is a lot of variation in how quickly these PUT URL and POST TO URL commands are executed. Often it is less than 1 second, but it can take more than 15 seconds.
I'm worried about my users attention span
I would like to implement a "Cancel" button - something that allows the user to abort the process of waiting for the results of the PUT URL and POST TO URL commands.
I can't think how I'd do this. If I understand correctly then the "standard" way to have a button abort a handler, is to have the button set an AbortNow value, and to insert code to test for the state of the AbortNow value within the handler. But in my case, by the time that I could test for the AbortNow value, after the PUT and POST statements, the wait would already have occurred.
Is there an easy way to do this?
Either that or is it possible to have these commands abort themselves after waiting a fixed period of time (e.g. 5 seconds)?
Thanks in advance.
At one point I'm using the following to check whether the mobile device is able to connect to the internet -
put URL "http://www.google.com" into ccConnCheck
if ccConnCheck is empty then...
At another point I'm using the following to check whether the mobile device is able to make contact with my online database -
post "" to URL "http://mywebsite.com/mywebsite-test-status.php"
put it into ccResponse
If ccResponse <> "Status=Received" then...
Where there is some PhP set up at the other end to respond to the POST.
It all "works", but I'm finding that there is a lot of variation in how quickly these PUT URL and POST TO URL commands are executed. Often it is less than 1 second, but it can take more than 15 seconds.
I'm worried about my users attention span

I would like to implement a "Cancel" button - something that allows the user to abort the process of waiting for the results of the PUT URL and POST TO URL commands.
I can't think how I'd do this. If I understand correctly then the "standard" way to have a button abort a handler, is to have the button set an AbortNow value, and to insert code to test for the state of the AbortNow value within the handler. But in my case, by the time that I could test for the AbortNow value, after the PUT and POST statements, the wait would already have occurred.
Is there an easy way to do this?
Either that or is it possible to have these commands abort themselves after waiting a fixed period of time (e.g. 5 seconds)?
Thanks in advance.