Cross-domain file help for ActionScript 3 Socket

Here is my ActionScript code:

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

Here is the file My CrossDomain.XML (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 get

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

I have never used it before, I don’t understand what is wrong with the syntax of my CrossDomain file.

Please, help.

+4
source share
1 answer

Socket policy files work a little differently than HTTP policy files; in particular, they are not served over HTTP or on port 80.

Instead, Flash Player checks the policy file server (port 843 by default) or, if necessary, the socket you open (for you, port 2222).

A policy file server is a socket that responds to <policy-file-request/> with a valid policy file. What happens to your message, it is likely that it sends its request and receives something other than a policy file, and therefore the invalid syntax from port 2222.

There are a lot of resources and a number of questions here on SO . Here is one tutorial from Adobe.

+4
source

Source: https://habr.com/ru/post/1300002/


All Articles