Reputation: 63369
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!
Upvotes: 1
Views: 2637
Reputation: 2216
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.
Upvotes: 1