ActionScript 3 Socket 跨域文件帮助 [英] Help with Cross-Domain file for ActionScript 3 Socket

查看:33
本文介绍了ActionScript 3 Socket 跨域文件帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 ActionScript 代码:

Here is My ActionScript Code:

  var S:Socket=new Socket("127.0.0.1",2222);

这是我的 CrossDomain.XML 文件(位于 http://127.0.0.1/crossdomain.xml)

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>

这是我遇到的错误

  Ignoring policy file at xmlsocket://127.0.0.1:2222 due to incorrect syntax. 

以前从未使用过,我不明白我的 CrossDomain 文件的语法有什么问题.

Having never used one before, I don't understand what's wrong with the syntax of my CrossDomain file.

请帮忙.

推荐答案

套接字策略文件的工作方式与 HTTP 策略文件略有不同;特别是,它们不是通过 HTTP 或端口 80 提供的.

Socket policy files work a little differently than HTTP policy files; in particular, they aren't served via HTTP, or at port 80.

相反,Flash Player 会检查策略文件服务器(默认情况下为 843 端口),或者在必要时检查您正在打开的套接字(对您而言为 2222 端口).

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).

策略文件服务器是一个套接字,它使用有效的策略文件响应 .您的消息发生的情况很可能是它正在发送请求并返回策略文件以外的其他内容,因此来自端口 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.

那里有很多资源,还有很多问题这里是 SO.这是来自 Adob​​e 的一个教程.

There are a lot of resources out there, and a number of questions here on SO. Here's one tutorial from Adobe.

这篇关于ActionScript 3 Socket 跨域文件帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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