问题
We have an AIR client sending HTTPService Post request to Tomcat. The operation takes more than 30 seconds in the server since its a files transfer operation.
By the time the server returns the response, Flex is throwing a fault, 2032, stream error ( checked a lot on the net ) Looks like its timing out after 30 seconds, waiting for the Http response.
i tried setting ht.requestTimeout, it did not work. Setting URLRequestDefaults.idleTimeout also is not working. Looks like i have hit a dead end on this.
Solutions please...
回答1:
You need to increase HTTPService timeout using property requestTimeout
Provides access to the request timeout in seconds for sent messages. A value less than or equal to zero prevents request timeout.
you could also use its fault event to catch timeout, and proceed accordingly.
Hope that Helps
回答2:
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.
来源:https://stackoverflow.com/questions/13295537/flex-air-httpservice-stream-error-and-timing-out