0

My question is related to the one asked here - Flash socket server only works on local machine

My flash application works fine running on a local apache server on my local machine but when I try and connect to a PHP socket server running on my Amazon server it fails to connect. I think my problem is related to the crossdomain file, but I can't find much information on it.

Here is my code.

AS3:

var host:String = "x.x.x.x"; // substituted for actual IP of website
var port:uint = 9999;

Security.allowDomain("*"); 
Security.loadPolicyFile("http://www.example.com/crossdomain.xml"); // substituted for actual domain name

socket.connect(host, port);

PHP:

$ip = '0.0.0.0';
$port = 9999;

Crossdomain:

<cross-domain-policy>
  <site-control permitted-cross-domain-policies="master-only"/>
    <allow-access-from domain="*.example.com"/>
</cross-domain-policy>

Let me know if I need to add any further information.

Thanks

Community
  • 1
  • 1
Tyler
  • 1
  • 1

1 Answers1

0

Check out this my answer Annoying Error #2048: Security sandbox violation from localhost, you need to setup socket policy server on 843 port or on your connection port (9999), rather then http delivered xml.

UPD: To debug the policy server do the following:

  1. Check that server installing is correct by the command (linux, mac or cygwin on Windows): echo -ne '<policy-file-request/>\0' | nc -v host port

  2. Turn on the flash player policy log by setting the flag PolicyFileLog=1 in mm.cfg file (be sure you have the debug version of flash player), run swf file and read the policy log, it has user friendly format, you will be able to figure out the problem in most cases by this log.

Community
  • 1
  • 1
fsbmain
  • 5,267
  • 2
  • 16
  • 23
  • I was able to set up a perl standalone server running from the cmd console but my flash application never connects to it. Could it be an issue with what ports my apache server is listening to? – Tyler Jul 27 '13 at 18:34
  • I updated my answer with instructions to debug your policy server – fsbmain Jul 27 '13 at 21:38
  • I'm still running into issues. I was able to set up a policy server on my server and using netcat on the local machine was able to hit the server, but using the perl command was not able to return the policy file. Using [perl -e 'printf "%c",0' | nc 127.0.0.1 843] it throws the error [Can't find string terminator "'" before EOF at -e on line 1. When I ^C out, my policy server returns this [Unrecognized Request]. When I try to connect from anywhere other than the local machine I am unable to. Do I need to change anything in the hhtp.config file on the apache server? – Tyler Jul 29 '13 at 23:22
  • Did you try my variant of policy server check command with _echo_ and _nc_ ? request to the policy server must be exactly equals to _\0_ ? It's also worth to debug connection with _PolicyFileLog_ turned to _1_ – fsbmain Jul 30 '13 at 07:03