AS3 + PHP套接字服务器连接问题 [英] AS3 + PHP Socket Server Connection Issues

查看:130
本文介绍了AS3 + PHP套接字服务器连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是有关一问在这里 - <一个href="http://stackoverflow.com/questions/1698029/flash-socket-server-only-works-on-local-machine">Flash socket服务器只能在本地机器

My question is related to the one asked here - Flash socket server only works on local machine

我的Flash应用程序工作正常运行的本地Apache服务器上我的本地机器,但是当我尝试连接到一个PHP socket服务器我的亚马逊的服务器上运行的连接失败。我想我的问题是关系到跨域文件,但我无法找到它的信息。

My flash application works fine running on a local apache server on my local machine but when I try and connect to a PHP socket server running on my Amazon server it fails to connect. I think my problem is related to the crossdomain file, but I can't find much information on it.

下面是我的code。

AS3:

var host:String = "x.x.x.x"; // substituted for actual IP of website
var port:uint = 9999;

Security.allowDomain("*"); 
Security.loadPolicyFile("http://www.example.com/crossdomain.xml"); // substituted for actual domain name

socket.connect(host, port);

PHP:

$ip = '0.0.0.0';
$port = 9999;

跨域:

<cross-domain-policy>
  <site-control permitted-cross-domain-policies="master-only"/>
    <allow-access-from domain="*.example.com"/>
</cross-domain-policy>

让我知道如果我需要添加任何进一步的信息。

Let me know if I need to add any further information.

感谢

推荐答案

看看这个我的回答<一href="http://stackoverflow.com/questions/17364372/annoying-error-2048-security-sandbox-violation-from-localhost/17365467#17365467">Annoying错误#2048:从本地主机的安全沙箱冲突,你需要设置套接字策略服务器的843端口或连接端口(9999)上,而不是HTTP传递XML

Check out this my answer Annoying Error #2048: Security sandbox violation from localhost, you need to setup socket policy server on 843 port or on your connection port (9999), rather then http delivered xml.

UPD: 要调试策略服务器执行以下操作:

UPD: To debug the policy server do the following:

  1. 检查服务器安装是由命令(在Linux,Mac或Cygwin的Windows上)正确的:回声-ne'&LT;政策性文件的请求/&GT; \ 0'| NC -v主机端口

通过设置标志 PolicyFileLog = 1 中的的mm.cfg 文件(请确保您有的 Flash播放器的调试版本),运行swf文件和读取策略日志,它具有用户友好的格式,你将能够通过这个弄清楚,在大多数情况下,问题登录。

Turn on the flash player policy log by setting the flag PolicyFileLog=1 in mm.cfg file (be sure you have the debug version of flash player), run swf file and read the policy log, it has user friendly format, you will be able to figure out the problem in most cases by this log.

这篇关于AS3 + PHP套接字服务器连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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