Page 1 of 1

crossdomain.xml

Posted: 21 Dec 2010, 23:06
by jz87
By default there is a crossdomain.xml in the config folder with the following:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- This is a master-policy file. site-control can be all,none,master-only -->
<site-control permitted-cross-domain-policies="all"/>

<!-- Instead of setting to-ports="*", administrators can use ranges and commas -->
<!-- This will allow access to ports 123, 456, 457, and 458 -->
<allow-access-from domain="*" to-ports="9933" />
</cross-domain-policy>

This should allow client from any domain to connect to 9933 right? When I try to connect from a unity webplayer client I get TCPSocketLayer unable to connect as no valid crossdomain policy was found.

I'm using
SmartFox sf = new SmartFox(true) // debug set to true
sf.Connect("127.0.0.1", 9933);

I'm either opening the html as a local file:// or loading it from SFS2X's webserver from http://localhost:8080. I have also tried to connect to a remote IP where I've replicated my local setup, in all cases I get this cross domain error.

Posted: 22 Dec 2010, 15:33
by Lapo
I think you need to use the prefetchPolicy command in Unity, otherwise by default the webplayer attempts to load the policy from port 843.

Posted: 22 Dec 2010, 20:54
by jz87
Ah ok, I contacted my hosting service and they told me you need to start the server as root to listen on ports < 1024.

Posted: 23 Dec 2010, 01:59
by Lapo
Yep, but it's not necessary to open a new port.
You can use the Security.PrefetchSocketPolicy() to force the webplayer into loading the policy from the port where you will connect to (e.g. 9933)

This is mentioned in the Unity manuals "Security Sandbox on the webplayer 3.0" page

The method should be called right before connecting to SFS

cheers