Flex Air - HTTPService TimeOut every time

2019-08-21 19:12发布

问题:

On my AIR app, i use HTTPservice with PHP.

PHP side : set_time_limit(0)

Air side : httpService.requestTimeout = 0

it doesn't work, with httpService.requestTimeout = 0, there is a time out after 30s. The FaultEvent is dispatched, while php is still running. The PHP script goes to the end without problems.

So i changed to httpService.requestTimeout = 99999.

There is no longer time out after 30s but after 120s. And it's not the FaultEvent that is dispatched but the ResultEvent. And PHP is still running and goes to the end if I don't stop the server !! But I cannot know through my Air app when the service is completed.

I tried to add URLRequestDefaults.idleTimeout = 99999000

but still the same =/

Does anyone have an idea ? Thanks

回答1:

I've been fighting this issue as well. Add this code snippet before you send() your request:

URLRequestDefaults.idleTimeout = 120000;  // in millis so this setting would timeout after 120 seconds.

It seems as though there's a bug in the Flash Player for AIR (Flex uses a different one) that ignores responseTimeout on the HTTPRequest object. This sets the timeout properly.