【问题标题】:actionscript: connect to socket serveractionscript:连接到套接字服务器
【发布时间】:2010-09-17 16:14:46
【问题描述】:

我正在使用 actionscript 连接到我的套接字服务器,但我总是收到从 actionscript 发送的<policy-file-request/>,然后连接被关闭。 actionscript中的代码是:

            protected function connect_to_server_btn_clickHandler(event:MouseEvent):void
        {
            Security.loadPolicyFile("http://192.168.0.198/crossdomain.xml");
            socket = new Socket();
            socket.addEventListener(Event.CONNECT, onConnect);
            socket.connect("192.168.0.198", 9999);
        }

crossdomain.xml的内容:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

swf和它的wrapper html都放在http://192.168.0.198/bin-debug/下,通过actionscript成功加载crossdomain.xml文件(通过抓包工具)。

如果我提供了 crossdomain.xml,我想我不应该得到&lt;policy-file-request/&gt;?提前致谢!

【问题讨论】:

  • 哦,谁能帮我编辑一下?看起来 crossdomain.xml 是不可见的。

标签: apache-flex flash actionscript-3 security sockets


【解决方案1】:

这里是如何解决的教程 http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html

Flash Player 检查策略文件服务器(默认为端口 843),或者如果需要,检查您正在打开的套接字(对您来说,端口 2222)。

另外,请阅读this

【讨论】:

猜你喜欢
  • 2011-03-21
  • 1970-01-01
  • 2017-02-25
  • 2021-02-11
  • 2014-10-16
  • 2021-04-19
  • 2011-04-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多