• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 606
  • Last Modified:

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

0
moshem
Asked:
moshem
  • 5
  • 4
  • 3
1 Solution
 
CyanBlueCommented:
You cannot set the timeout value in ActionScript...  Not sure what the solution is thought...

CyanBlue
0
 
jeremyBass26Commented:
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

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

CyanBlue
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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

cheers
jeremyBass
0
 
moshemAuthor Commented:
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...
0
 
jeremyBass26Commented:
but you should be able to loop and fake a new request...? just thinking out loud...
0
 
jeremyBass26Commented:
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;
0
 
CyanBlueCommented:
It'd be nice if you could close this topic if you resolved the problem...  ;)

CyanBlue
0
 
moshemAuthor Commented:
Hey,

I didn't

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

CyanBlue
0
 
moshemAuthor Commented:
no, becuase after about 15, flash gives up and returns with an error, while actual timeout of the server could be 45 seconds
0
 
CyanBlueCommented:
Any update???

CyanBlue
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now