Link to home
Start Free TrialLog in
Avatar of moshem
moshem

asked on

sendAndLoad Timeout

Hi,

I have a code that interacts with a webservice.

some requests may take up to 45 seconds to return, the problem is sendAndLoad gives up much sooner.

how can I set the timeout for sendAndLoad ?






thanks
request_obj.sendAndLoad

Open in new window

Avatar of CyanBlue
CyanBlue
Flag of United States of America image

You cannot set the timeout value in ActionScript...  Not sure what the solution is thought...

CyanBlue
would something like this work... ?

// import the class:
import com.gskinner.net.LoadVars2;
myLV:LoadVars2 = new LoadVars2();
// subscribe to its data event:
myLV.addEventListener("data",this);
 
// add some data to send:
myLV.username = "frank";
myLV.password = "cheesepenguin";
 
// set the timeout period to 10 seconds (default is 7s):
myLV.timeout = 10000;
 
// this should timeout after 10 seconds:
myLV.sendAndLoad("http://1.1.1.1/noFile.php",myLV,"POST");
 
// function to handle the data event:
function data(p_evtObj:Object):Void {
   if (p_evtObj.src != undefined) {
      trace("Loaded successfully with source: "+p_evtObj.src);
    } else {
      trace("An error occurred while loading");
    }
}

Open in new window

Interesting...  Never seen such class before...  Thanks, jeremyBass26...  ;)

CyanBlue
wasn't sure if it'd fit the need here... Just trying to help and learn too hehe :D

cheers
jeremyBass
Avatar of moshem
moshem

ASKER

this is very nice, but this allows me to set a timeout that is smaller than the default one set by the parent class LoadVars..

which means if I can't extent the default timeout set by the parent, I am still out of luck here....

as the default  timeout is too short...
but you should be able to loop and fake a new request...? just thinking out loud...
wait... did you try to set is at a high number?

this is the code I put up

// set the timeout period to 10 seconds (default is 7s):
myLV.timeout = 10000;
It'd be nice if you could close this topic if you resolved the problem...  ;)

CyanBlue
Avatar of moshem

ASKER

Hey,

I didn't

I could not find a way to detect timeout... did you ?
It seems like what jeremyBass suggested should work???  If not, can you post the code you have tried???

CyanBlue
Avatar of moshem

ASKER

no, becuase after about 15, flash gives up and returns with an error, while actual timeout of the server could be 45 seconds
ASKER CERTIFIED SOLUTION
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial