1

I am using actionscript to connect to my socket server, but I always got <policy-file-request/> sent from actionscript and after that the conneciton is closed. The code in actionscript is:

            protected function connect_to_server_btn_clickHandler(event:MouseEvent):void
        {
            Security.loadPolicyFile("http://192.168.0.198/crossdomain.xml");
            socket = new Socket();
            socket.addEventListener(Event.CONNECT, onConnect);
            socket.connect("192.168.0.198", 9999);
        }

The content of 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="*" />
</cross-domain-policy>

The swf and it's wrapper html are all put under http://192.168.0.198/bin-debug/, and the crossdomain.xml file is loaded by actionscript successfully(thru packet capture tool).

I think supposely I shouldn't get <policy-file-request/> if I provided the crossdomain.xml? Thanks in advance!

Eugene
  • 2,226
  • 1
  • 14
  • 15
Bin Chen
  • 61,507
  • 53
  • 142
  • 183

1 Answers1

1

Here is tutorial how to solve http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html

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

Also, read this.

Community
  • 1
  • 1
Eugene
  • 2,226
  • 1
  • 14
  • 15
  • you can also find some opensource project based on python, which releases this server, and answering with your custom crossdomain file on 843 port. Like this one http://www.webmechs.com/actionscript-3-tutorials/actionscript-echo-server.html You could even find some deb/rpm package. – Eugene Sep 20 '10 at 05:16
  • Or you can use my Apache 2 module answering requests at the port 843: http://code.google.com/p/mod-socket-policy/source/browse/trunk/ – Alexander Farber May 19 '11 at 11:17