Dave
Dave

Reputation: 596

AS3 Handling no internet connection with HTTPService

I need to retry a specific HTTP Service call when there is no internet connection. Any suggestions. My FaultEvent comes with a fault with errorID == 0. It would make sense for me that a very specific error code comes so I can be sure of how to handle this specific situation. The only place where I get a an error code is on the rootCause from the FaultEvent. Anybody has suggestions of how to be sure that a fault occured out of internet connection.

Thanks, Dave

Upvotes: 1

Views: 267

Answers (1)

Dave
Dave

Reputation: 596

If anyone is interested in how I solved the problem. It is not a perfect solution, basically what I do is I make what I call a dummy server ping. It is not easy to ping the server straight from Flex but you can make an HTTP request for something on the server. Even if the link does not exist if you are online you get a status code 404 from the server instead of the 0 that comes when you are offline. So I make a Http call for mydomain//nofile.html. The link does not exist so the server sends me a 404 and I know I am online.

Worked for me.

Dave

Upvotes: 1

Related Questions