-1

I've set up a server using the ServerSocket class in the AIR framework, and the client (.swf) connects fine through localhost, but when I upload the finished server application to a remote environment it refuses to connect at all. Policy files wont even load.

I've added both the policy file port (843) and the port of my applications main ServerSocket (6644) to the firewall settings and allowed both Inbound and Outbound connections to them.

I have checked to make sure that I changed the IP to which flash connects to the public IP of my server, and with the firewall settings in place, I don't understand why it wont connect.

This is the first time I've worked with Sockets in the AIR framework, but I can't work out why it wouldn't work if it worked fine on a localhost connection (running on my laptop), especially after the ports have been allowed via the firewall settings.

Here is also the policy file that the server sends, which should definitely allow access to the server, as far as I'm aware (worked locally, so shouldn't be any different):

public var policy:String = '<?xml version="1.0"?><cross-domain-policy>' +
'<site-control permitted-cross-domain-policies="master-only"/>' +
'<allow-access-from domain="*" to-ports="6644" />' +
'</cross-domain-policy>\x00';

Anyone got any ideas as to why it isn't working?

securityErrorHandler: Error #2048: Security sandbox violation: 
Neguido
  • 235
  • 2
  • 13
  • possible duplicate of [Flex - Security Sandbox violation - ERROR#2048](http://stackoverflow.com/questions/5157089/flex-security-sandbox-violation-error2048) – CyanAngel Dec 01 '14 at 11:08
  • Can you load the policy file manually via `http://yourserver.com:843/crossdomain.xml` ? Also, see http://stackoverflow.com/questions/2181320/help-with-cross-domain-file-for-actionscript-3-socket – Brian Dec 01 '14 at 18:27
  • @CyanAngel Flash policy files no longer work in this way. – Neguido Dec 01 '14 at 23:21
  • @Brian The policy xml is sent through a socket by the Server as a string, not as an .xml file, as shown in the question. – Neguido Dec 01 '14 at 23:22
  • @Neguido You missed the point. Can you load the policy file manually or not? – Brian Dec 02 '14 at 03:21
  • @Brian Oh no, that doesn't work. Although, I could add a few lines of code to the server to see if the policy server request actually comes through or not? Is it actually possible that the policy file could be the problem even though it worked locally? – Neguido Dec 02 '14 at 03:28
  • While doing this I noticed that flash isn't sending a policy request anymore. I know in the docs it says the .swf saves the policy file within itself for future connections but, I'm pretty sure it should be requesting a new one - any chance this could be related? – Neguido Dec 02 '14 at 06:11

2 Answers2

0

Turns out the problem was resources. Added a couple GB RAM and extra disk space and it works flawlessly. Knew it couldn't be a problem with the actual programming.

Neguido
  • 235
  • 2
  • 13
-1

The error is related to a "Security sandbox" violation. To fix it you can add:

conn.allowDomain('*');
tutuDajuju
  • 10,307
  • 6
  • 65
  • 88
DeliaHu
  • 1
  • 2