Sandbox violation when sending a second socket

I have a Flex client using a binary (TCP) Flash socket to communicate with a Java server. I have a localhost server (Apache) that provides a crossdomain.xml file that is wide open only during testing.

My code successfully loads the policy file at startup.

Then I will connect the socket to the server without any problems and send a message and get a response. All is good so far.

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

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 was obtained.

I tried to reload the policy file before each submission, but I get the same result.

Any idea why this might happen? I obviously have an open outlet at one point. I soak the socket after each send, and I tried to do it after each read, but the same result.

Thanks in advance

EDIT:
If I recreate the socket before each call, my code works. I'm struggling to believe this is correct, but maybe there is a Socket parameter that I am missing.

+4
source share
4 answers

As far as I know, if you make binary sockets, crossdomain.xml is not loading via http.

Have you checked apache access logs if a crossdomain request is even requested?

You can get a connection to the flash via tcp from flash by requesting a file on your java server (without using http. It just sends the string "" or similar). Watch them. If you do not answer them within 3 seconds (or so), the flash causes a sandbox violation.

+1
source

The first thing you need to do when you want to connect to the socket is to download the policy file. This needs to be done only once per SWF download.

 Security.allowDomain(host); Security.loadPolicyFile("xmlsocket://"+host+":"+port); 

The request will be executed on the designated port (45455 in your case), your server will have to listen to this port for the request "<policy-file-request/>" without quotes. When this request is found, you need to return crossdomain.xml to the client with node <allow-access-from domain="*" to-ports="*" />

After sending the cross-domain, you need to close the socket on the server side On the client side, you need to ignore the domain response, since Flex will handle this, but at the same time you can reconnect to the socket server. At this time, you can send and receive your data.

I feel like it really worked for you because you used the connection for the policy file to transfer your data before the timeout.

I would suggest reading the new crossdomain rule style, as well as reading the protocol that you use for your socket server.

+1
source

I think it depends on the sandbox policy that you used in the process of compiling your swf, and not on your crossdomain.xml ... maybe this document will help you: Protected sandboxes

But I'm not 100% sure

0
source

Sounds like cache problem. Perhaps you pull the first socket connection out of the cache, and the second is rejected because it receives 200 from the server.

You might want to add localhost to the flash exclusion list for debugging. which will soothe bugs in the sandbox until you get your part to the working environment.

0
source

All Articles