安全沙箱冲突,无法通过套接字连接到服务器 [英] Security Sandbox Violation, can't connect to Server via Socket

查看:395
本文介绍了安全沙箱冲突,无法通过套接字连接到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我开始之前,我应该声明我已阅读这一切,我是继<一href="http://stackoverflow.com/questions/5678058/security-sandbox-violation-lack-of-policy-file-permissions/5678960#5678960">this, 和的这个(更多...),仍然无法通过套接字连接到我们的正在运行的服务器在互联网上。

Before I start I should state I have read it all, I was following this, this and this (and more...) and still I cannot connect to our running server via Socket over the internet.

下面是我在AS3尝试:

Here is what I try to in AS3:

        var host :String = "192.168.2.11";
        Security.allowDomain(host);
        Security.allowInsecureDomain(host);
        Security.loadPolicyFile("xmlsocket://" + host + ":" +  "843");

        // TTS server socket
        _socket = new Socket();
        _socket.addEventListener(Event.CLOSE, handleClose);
        _socket.addEventListener(IOErrorEvent.IO_ERROR, handleError);
        _socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleSecError);
        _socket.addEventListener(ProgressEvent.SOCKET_DATA, handleIncomingData);
        _socket.addEventListener(Event.CONNECT, handleConnect);
        _socket.connect(host, 1337);

正如你所看到的,主机是本地地址,但是这不应该的问题,只要我在这个本地网络。而我,因为这样做的工作,从我的IDE(FD4)。 此外,瑞士法郎是在同一台服务器,因为它试图连接到应用程序,但对其他端口。

As you can see, the host is a local address, but that shouldn't matter as long as I am in this local network. And I am, since this does work from my IDE (FD4). Also, the swf is on the same server as the application it tries to connect to, but on another port.

服务器发送(我们无论是从端口843和1337试过)策略文件如下:

The policy file the server sends (we have tried both from port 843 and 1337) is the following:

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

我们可以认为这是真正发送到连接插座服务器的日志输出看到。一个空字节当然是XML数据之后发送的。而在这之后,服务器将关闭连接。然而,似乎闪光灯不知何故不喜欢它,因为错误#2048仍然出现〜3秒后。

We can see from the log output of the server that this is really sent to the connecting socket. A null byte is of course sent after the xml data. And after that, the server closes the connection. However, it seems that Flash somehow does not like it, as "Error #2048" still appears after ~3 seconds.

我们真的离开这里的想法......

We're really out of ideas here...

推荐答案

我们设法得到它通过包括其他标记工作:

We managed to get it to work by including another tag:

<site-control permitted-cross-domain-policies="master-only"/>

看来,这个标签是必要的,以便得到它的工作。我们无法得到它没有这个标签,无论我们试图哪个端口工作。

It seems that this tag is necessary in order to get it to work. We could not get it to work without that tag, no matter which port we tried.

所以,完整的XML现在看起来像这样在我们的例子(当然是容易修改,以适应任何情况下):

So the complete xml now looks like this in our case (it is of course easy to modify to fit any case):

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <site-control permitted-cross-domain-policies="master-only"/>
   <allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>

这真的是一种耻辱,这行不包括在 Adob​​e自己的例子( !)。我的意思是,它包含在示例文件,但没有在文章。我不想知道有多少人被卡,因为在这个阶段...

It really is a shame that this line is not included in Adobe's own example (!!). I mean, it IS included in the example files, but not in the article. I don't want to know how many people were stuck at this stage because of that...

这篇关于安全沙箱冲突,无法通过套接字连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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