首先我們看一下以下這篇文章:
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html
注意以下內容:
Socket policy request process
Flash Player checks for a socket policy file in three places for each IP connection. The checks occur in the following order:
- Flash Player first checks port 843 to determine if there is a socket master policy file. If there is no socket master policy file or the socket master policy file has a
site-control
tag specifying"all"
, then Flash Player proceeds to the next step. If thesite-control
tag has a value of"none"
, then the process stops and the socket is denied a connection.
- If an ActionScript
Security.loadPolicyFile()
command exists within the SWF file, then the Flash Player runtime checks that location. Flash Player checks the destination of theloadPolicyFile()
only after it has checked the master policy file on port 843 for permission to acknowledge other policy files. If the developer has not specified aloadPolicyFile()
command, then Flash Player checks the destination port of the connection.
- The destination port of the connection is the last check made by Flash Player. This check is only performed if the socket master policy file permits Flash Player to check additional locations. If Flash Player still cannot locate a policy file granting permission, then the socket connection is denied.
What data is sent in the request and response?
The request for a policy file is very simple: Flash Player sends the string<policy-file-request/>
followed by aNULL
byte to the port where it is requesting a policy file; no more, no less. Flash developers cannot modify the string that is sent. In return, Flash Player expects to receive the socket policy file as text. Once Flash Player receives the socket policy file, it closes the connection and opens a new connection if the policy file approves the request.
所以我們要做的就是在flash端設置檢索策略文件的位置,此設置應該在socket.connect()之前
Security.loadPolicyFile("xmlsocket://yourpolicyserver:port");
然後在指定端口監聽,並返回策略文件即可
如下(使用apache mina):
分享到:
相关推荐
mina-core-2.0.0-RC1.jar,mina-filter-compression-2.0.0-RC1.jar,mina-transport-apr-2.0.0-RC1.jar
mina-core-2.0.0-M6.jar mina-example-2.0.0-M6.jar mina-filter-codec-netty-2.0.0-M6.jar mina-filter-compression-2.0.0-M6.jar mina-integration-beans-2.0.0-M6.jar mina-integration-jmx-2.0.0-M6.jar mina-...
mina-filter-compression-2.0.7.jar,mina 过滤器jar包,核心包之一
mina-core-2.0.0-M1.jar/mina-example-1.0.5.jar/slf4j-jdk14-1.6.1.jar/slf4j-log4j12-1.6.1.jar mina 所用jar
apache-mina-2.0.16.zip
mina-integration-beans-2.0.0-M4.jar mina-integration-beans-2.0.0-M4.jar
mina-integration-ognl-2.0.0-M4.jar mina-integration-ognl-2.0.0-M4.jar
截止目前最新版mina框架源码和jar包,apache-mina-2.1.3所有jar和源文件.7z
apache-mina-2.0.16-bin.zip;apache-mina-2.0.16.zip
Apache MINA是 Apache 组织一个较新的项目,它为开发高性能和高可用性的网络应用程序提供了非常便利的框架。 当前发行的 MINA 版本支持基于 Java NIO 技术的 TCP/UDP 应用程序开发、串口通讯程序(只在最新的预览版...
apache-mina-2.0.4-src
mina-core-2.0及其他相关jar,mina-core-2.0及其他相关jarmina-core-2.0及其他相关jarmina-core-2.0及其他相关jarmina-core-2.0及其他相关jar
mina-core-2.0.0-M1-sources.jar是构建mina框架的主要文件
mina-transport-apr-2.0.2.jar
mina-core-2.0.0-M1.jar包和slf4j相关jar包
apache-mina-2.0.7-bin.tar,apache-mina-2.0.7-src.tar,rxtx-2.0-7pre1-i386-pc-mingw32,rxtx-2.1-7r2
mina-core-2.0.0-RC1-sources.jar
mina-filter-compression-2.0.2.jar
mina-core-2.0.1.jar,apache-mina-2.0.1
MINA-2.0.0-M4 API帮助文档(CHM) MINA-2.0.0-M4 英文版