Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
738 views
in Technique[技术] by (71.8m points)

apache flex - Help with Cross-Domain file for ActionScript 3 Socket

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...