Apache – Sandbox violation on second socket send

apache-flexflex3sandboxsockets

I have a Flex client using a Flash binary (TCP) socket for communication with a Java server. I have a localhost (Apache) server providing a crossdomain.xml file which is wide open just while I am testing.

My code successfully loads the policy file on startup.

I then connect the socket to the server without any difficulty and send a message and get a response. All good so far.

However, when I send a second message through the same socket I get a pause of about 12 seconds then a sandbox violation error:

Security Error: Error #2048: Security sandbox violation: file:///C:/apache_root/ttt1/ttt1.swf cannot load data from localhost:45455.

This is the same port and socket through which the first message succeeded.

I tried re-loading the policy file before every send, but I get the same result.

Any idea why this might be happening? I clearly have an open socket at one point. I am flushing the socket after each send and I tried doing that after each read as well, but the same result.

Thanks in advance

EDIT:
If I recreate the socket prior to every call my code works. I am struggling to believe that this is correct, but maybe there is a Socket setting I am missing.

Best Answer

As far as I know if you're doing binary sockets the crossdomain.xml is not loaded via http.

Have you checked your apache's access logs if the crossdomain is even queried?

You might get connection from flash via tcp from flash asking for the file on your java server (not using http. It just sends the string "" or similar). Look out for them. If you don't answer them within 3 seconds (or so) flash throws an sandbox violation.

Related Topic