AIR 2.6的ServerSocket和ActionScript 3套接字连接AIR、ActionScript、ServerSocket

2023-09-09 21:55:59 作者:就差一点成熟

我已经写在AIR 2.6的服务器应用程序。我使用ServerSocket类服务器端和客户端是写在ActionScript 3中,并使用Socket类。当我的客户端连接到服务器,本地IP(127.0.0.1或192.168.0.2),我得到这个消息:<政策性文件的请求/> 。我再从服务器发送我的政策文件,客户端和连接成功。

I have written a server application in AIR 2.6. I use the ServerSocket class for the server side and the client side is written in actionscript 3 and uses the Socket class. When I connect the client to server with local IP (127.0.0.1 or 192.168.0.2), I get this message: <policy-file-request/>. I then send my policy file to client from server and connection is successfully.

但是,当我连接客户机到服务器与我的全球知识产权(IP通过我的ISP分配的),我得到了相同的策略文件请求消息,但连接不能建立。端口被打开(843,4444和5555),但仍然没有运气。我的策略文件如下:

However, when i connect client to server with my global IP (IP assigned by my ISP), I get the same policy file request message but the connection cannot be established. Ports are opened (843, 4444 and 5555) but still no luck. My policy file is as follows:

< ?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>

我有一个字符串类型,等于这一政策+ String.fromChar code变量中(0)。

I have variable with string type, that equals this policy+String.fromCharCode(0).

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

推荐答案

请检查您的路由器设置,并确保其运行服务器的本地机器有足够的网络权限,建立在首位的连接。要做到这一点最简单的方法是找到你的路由器设置非军事区设置,并添加您的服务器计算机的IP地址。我不知道这是问题,不过,因为你说你还是收到了插座......这是令人费解的策略请求。然而,在present时间,你已经提供了所有我能做的真的细节是使一个受过教育的猜测在这一点上,DMZ听起来就像是最可能的原因。

Check your router settings and ensure that the local machine which is running the server has sufficient network privileges to establish the connection in the first place. The easiest way to do this is to find the DMZ setting in your router config and add the IP address of your server machine. I'm not sure that this is the issue though, because you stated that you still receive the policy request over the socket... which is puzzling. However, at present time with the details that you have provided all I can do really is make an educated guess and at this point, DMZ sounds like the most probable cause.

另外请注意,您的域策略,你真的不应该(在生产中code)允许任何客户端任何套接字连接通过。这违背了安全模型的全部目的。反正这是我能与当前的信息给出最好的答案。我也建议你阅读这篇文章是由Adobe关于处理的ServerSocket和客户端连接。

Also note that in your domain policy you really should not (in production code) allow ANY client to connect over ANY socket. That defeats the entire purpose of the security model. Anyway that is the best answer I can give with the current information. I'll also recommend reading this article by Adobe about dealing with ServerSocket and client connections.

http://www.adobe.com/devnet/air/flex/quickstart/articles/communicating_with_sockets.html#articlecontentAdobe_numberedheader_3