Flex Air - 每次 HTTPService 超时 [英] Flex Air - HTTPService TimeOut every time

查看:21
本文介绍了Flex Air - 每次 HTTPService 超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 AIR 应用程序中,我将 HTTPservice 与 PHP 结合使用.

On my AIR app, i use HTTPservice with PHP.

PHP 端:set_time_limit(0)

空方:httpService.requestTimeout = 0

它不起作用,httpService.requestTimeout = 0,30s 后有超时.FaultEvent 被调度,而 php 仍在运行.PHP 脚本运行到最后没有问题.

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.

所以我改为httpService.requestTimeout = 99999.

不再是 30 秒后超时,而是 120 秒后超时.并且它不是分派的 FaultEvent 而是 ResultEvent.如果我不停止服务器,PHP 仍在运行并运行到最后!!但是我无法通过我的 Air 应用程序知道服务何时完成.

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.

我尝试添加URLRequestDefaults.idleTimeout = 99999000

但还是一样=/

有人有想法吗?谢谢

推荐答案

我也一直在努力解决这个问题.在 send() 请求之前添加此代码片段:

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.

似乎 Flash Player for AIR(Flex 使用不同的播放器)中存在一个错误,它忽略了 HTTPRequest 对象上的 responseTimeout.这会正确设置超时.

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.

这篇关于Flex Air - 每次 HTTPService 超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆