Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AS3&x2B;PHP套接字服务器连接问题_Php_Actionscript 3 - Fatal编程技术网

AS3&x2B;PHP套接字服务器连接问题

AS3&x2B;PHP套接字服务器连接问题,php,actionscript-3,Php,Actionscript 3,我的问题与这里提出的问题有关- 我的flash应用程序在本地机器上的本地apache服务器上运行正常,但当我尝试连接到在Amazon服务器上运行的PHP套接字服务器时,它无法连接。我认为我的问题与跨域文件有关,但我找不到太多关于它的信息 这是我的密码 AS3: var host:String = "x.x.x.x"; // substituted for actual IP of website var port:uint = 9999; Security.allowDomain("*");

我的问题与这里提出的问题有关-

我的flash应用程序在本地机器上的本地apache服务器上运行正常,但当我尝试连接到在Amazon服务器上运行的PHP套接字服务器时,它无法连接。我认为我的问题与跨域文件有关,但我找不到太多关于它的信息

这是我的密码

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);
$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>
PHP:

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);
$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>
跨域:

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);
$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>

如果我需要补充更多信息,请告诉我

谢谢查看我的答案,您需要在843端口或连接端口(9999)上设置socket policy server,而不是http交付的xml

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

  • 通过以下命令检查服务器安装是否正确(Windows上的linux、mac或cygwin):
    echo-ne'\0'\124; nc-v主机端口

  • 通过在文件中设置标志
    PolicyFileLog=1
    打开flash player策略日志(确保您拥有flash player的权限),运行swf文件并读取策略日志,它具有用户友好的格式,您将能够通过此日志在大多数情况下找出问题


  • 我能够设置一个从cmd控制台运行的perl独立服务器,但我的flash应用程序从未连接到它。我的apache服务器正在侦听的端口可能有问题吗?我更新了答案,并给出了调试策略服务器的说明。我仍然遇到问题。我能够在我的服务器上设置策略服务器,并且在本地计算机上使用netcat能够访问服务器,但是使用perl命令无法返回策略文件。使用[perl-e'printf“%c”,0'| nc 127.0.0.1 843]会在第1行的EOF at-e之前抛出错误[Can't find string terminator“”。当I^c out时,我的策略服务器返回此[Unrecogned Request]。当我尝试从本地计算机以外的任何位置进行连接时,我无法进行连接。我是否需要更改apache服务器上的hhtp.config文件中的任何内容?是否尝试了我的策略服务器检查命令的变体(带有echo和nc)?对策略服务器的请求必须完全等于\0?使用PolicyFileLog tur调试连接也是值得的内定为1