ActionScript 3 套接字的跨域文件帮助
这是我的 ActionScript 代码:
var S:Socket=new Socket("127.0.0.1",2222);
这是我的 CrossDomain.XML 文件(位于 http://127.0.0.1/crossdomain。 xml)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="2222"/>
</cross-domain-policy>
这是我遇到的错误
Ignoring policy file at xmlsocket://127.0.0.1:2222 due to incorrect syntax.
以前从未使用过,我不明白我的 CrossDomain 文件的语法有什么问题。
请帮忙。
Here is My ActionScript Code:
var S:Socket=new Socket("127.0.0.1",2222);
Here is My CrossDomain.XML File (Located at http://127.0.0.1/crossdomain.xml)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="2222"/>
</cross-domain-policy>
Here is The Error I Am Getting
Ignoring policy file at xmlsocket://127.0.0.1:2222 due to incorrect syntax.
Having never used one before, I don't understand what's wrong with the syntax of my CrossDomain file.
Please Help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
套接字策略文件的工作方式与 HTTP 策略文件略有不同;特别是,它们不是通过 HTTP 或端口 80 提供服务。
相反,Flash Player 会检查策略文件服务器(默认情况下为端口 843),或者如有必要,会检查您正在打开的套接字(对于您来说,端口 2222 )。
策略文件服务器是一个套接字,它用有效的策略文件响应
。您的消息所发生的情况很可能是它正在发送请求并获取除策略文件之外的其他内容,因此来自端口 2222 的语法无效。那里有很多资源,并且存在许多问题 这里就这样。这是 Adobe 的一个教程。
Socket policy files work a little differently than HTTP policy files; in particular, they aren't served via HTTP, or at port 80.
Instead, Flash Player checks for a policy file server (port 843 by default), or if necessary, on the socket you're opening (for you, port 2222).
A policy file server is a socket which responds to a
<policy-file-request/>
with a valid policy file. What's happening with your message is likely that it's sending its request and getting something other than a policy file back, hence invalid syntax from port 2222.There are a lot of resources out there, and a number of questions here on SO. Here's one tutorial from Adobe.