Hi, I am trying to make a flash client connect to a Java server with a socket. Now once I load this onto a webpage, It returns <policy-file-request/> in the Java and these error shows up on the client
“[SecurityErrorEvent type=“securityError” bubbles=false cancelable=false eventPhase=2 text=“Error #2048”]”. Now this is the client:
var s :Socket = new Socket("72.39.245.71", 1234);
Security.loadPolicyFile("http://www.free-javatutorials.com/crossdomain.xml");
s.addEventListener(ProgressEvent.SOCKET_DATA, sData);
s.addEventListener(Event.CONNECT, onConnect);
s.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
function sData(e:ProgressEvent):void {
var d:String = s.readUTFBytes(s.bytesAvailable);
Text.text += d;
}
function onConnect(s:Boolean):void {
if(s) {
Text.text += "Connection successful..."
} else {
Text.text += "Connection failed..."
}
}
function onSecurityError(e:Event):void {
Text.text += e;
}
This is the xml file:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
</cross-domain-policy>
I have no idea what is wrong and how I can fix. All I know is that it is a sandbox issue.
If anyone knows how to fix this or would like to help me then I would be more than thankful.