Page 1 of 1

Erorr: Previous Request Not Completed

Posted: Mon Apr 20, 2015 10:56 am
by pkmittal
Hi,

My program wants to send HTTP request to PHP URL every 3 seconds (for multilayer game I am developing). To do this, I am using On Idle method which is sending http request every 3 seconds..

Now the program can send more HTTP Request in other handlers when when user has made some move.. ( Idle handler is already sending request in back ground). This start giving error message "Previous Request Not completed" quite often.. Does it mean that Live Code can not send http request when the previous request is not completed..

How can I resend the request automatically so that it works again.. Let say I have handler updateMove

Code: Select all

on updateMove
put postUserMove(username, movedpi, fromPlaceHolder,toPlaceHolder,serverPHTable) into returnText
   
   if returnText contains "Success" then
      Answer "Your move have been updated successfully."
  else

  end if



end  updateMove
What should I change in function below so that when HTTP request through the error message "Previous request not compelted" then it sends the request automatically by calling the function again unless it is successful... I am trying the code below but it is getting recursive..and I need to know the right way of calling it..

Code: Select all

function postUserMove username, movedpi, fromPlaceHolder,toPlaceHolder,serverPHTable
   
   post postString to URL (urlString)
      put it into returnText 
  
    if returnText contains "previous request not completed" then
      postUserMove (username, movedpi, fromPlaceHolder,toPlaceHolder,serverPHTable)
      end if
   
   
   return returnText 
   
end postUserMove


Please help