I am running nodejs based server and I want to use Flash as the interface.
in AS3 I write:
Security.loadPolicyFile("xmlsocket://151.248.124.213:3843");
so that should load policy file at this adress http://151.248.124.213:3843/
.
links wouldn't work for now. but here is content of policy file:
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*"/>
<allow-access-from domain="151.248.124.213" to-ports="80"/>
</cross-domain-policy>
And here is the application http://151.248.124.213/1.html
But when I start using it, it sends me the message:
<policy-file-request/>
AS3 talking to server at the same IP:3000.
Nodejs is on VDS server and runs perfectly. When I start SWF from Flash Builder, everything works fine. So the problem must be somewhere in the policy file or in AS3 trying to load one.
I solved the problem with this code in policy file server
var net = require('net');
var netserver = net.createServer(function(socket){
socket.addListener("error",function(err){
socket.end && socket.end() || socket.destroy && socket.destroy();
});
var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM \n"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">\n<cross-domain-policy>\n';
xml += '<site-control permitted-cross-domain-policies="master-only"/>\n';
xml += '<allow-access-from domain="*" to-ports="*"/>\n';
xml += '</cross-domain-policy>\n';
if(socket && socket.readyState == 'open'){
socket.write(xml);
socket.end();
}
});
netserver.addListener("error",function(err){});
netserver.listen(3843, '0.0.0.0');
'0.0.0.0' - that is your IP or domain
And that is what you use to connect from flash
Security.loadPolicyFile("xmlsocket://151.248.124.213:3843");
if you want me to explain some details, let me know.