PDA

View Full Version : Web Server, Socket Server and Security sandbox violation


woaizheda
02-17-2009, 06:26 AM
Hi all,

I am writing an chat program based on flex and darkstar. And I have host the release build of this application in Tomcat. Here is my crossdomain.xml:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" to-ports="1139"/>
</cross-domain-policy>

I can access this file through http://localhost:8080/crossdomain.xm. But when I browse the page with socket connection, it turns out with Error #2048: Security sandbox violation. However, I can browse the page through flex builder run. But the one in bin-release folder doesn't work neither.
Here is part of the code in the chat client:

var ipAddress:String = "localhost";
Security.loadPolicyFile("http://"+ipAddress+":8080/crossdomain.xml");
sock.addEventListener(Event.CLOSE, onClose);
sock.addEventListener(Event.CONNECT, onConnect);
sock.connect(ipAddress,1139);

Is there any solution to this? I have reviewed many threads, but still can't work it out. Can anyone help me? Many thanks.

regards,
Ken