Air XmlHttpRequest time out if remote server is offline?

Posted by Seth on Stack Overflow See other posts from Stack Overflow or by Seth
Published on 2009-09-08T00:44:36Z Indexed on 2010/03/15 19:19 UTC
Read the original article Hit count: 356

Filed under:
|
|

I'm writing an AIR application that communicates with a server via XmlHttpRequest.

The problem that I'm having is that if the server is unreachable, my asynchronous XmlHttpRequest never seems to fail. My onreadystatechange handler detects the OPENED state, but nothing else.

Is there a way to make the XmlHttpRequest time out?

Do I have to do something silly like using setTimeout() to wait a while then abort() if the connection isn't established?

Edit: Found this, but in my testing, wrapping my xmlhttprequest.send() in a try/catch block or setting a value on xmlhttprequest.timeout (or TimeOut or timeOut) doesn't have any affect.

© Stack Overflow or respective owner

Related posts about air

Related posts about JavaScript