【问题标题】:connect to socket in as3连接到 as3 中的套接字
【发布时间】:2014-11-11 11:19:09
【问题描述】:

我想在 as3 中使用套接字制作一个聊天应用程序。 我已经遵循了很多例子,但没有一个有太大帮助。 现在我正在关注this 链接。

我正在使用 xampp 在 localhost 上运行 php。此外,我已经运行了 page cmets 中所写的 policySocketServer.php,socketServer.php。

我正在使用它来加载策略文件

Security.loadPolicyFile("xmlsocket:127.0.0.1/chat/crossdomain.xml:843");

并连接到ourXMLSocket.connect("http://127.0.0.1/chat/", "9999");

但我收到了这些错误

    IOErrorEvent error  Error #2031: Socket Error. URL: http://127.0.0.1/chat/
security error  Error #2048: Security sandbox violation: file:///C|/Users/irfan/Desktop/socket%5Fserver/socket%5Fserver.php/AS3%20Game%20Implementation/TestGame.swf cannot load data from http://127.0.0.1/chat/:9999.

【问题讨论】:

    标签: actionscript-3 sockets cross-domain-policy


    【解决方案1】:

    阅读错误信息:

    安全沙箱违规:file:///C........swf 无法加载数据 来自 http://....

    尝试从 http 协议而不是文件协议运行您的 swif。这应该可以解决安全问题。

    【讨论】:

    • 现在我将我的 swf 嵌入到 html 中,并使用 127.0.0.1/chat/index.html 运行它,但我仍然遇到安全错误。错误 #2048
    • 在 SecurityErrorEvent.SECURITY_ERROR 监听器中,我得到了这个 event.text=Error #2048,event.errorID=0,仅此而已。是的,但现在没有 IOError 即将到来。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-03
    相关资源
    最近更新 更多