- Home /
socket and crossdomain problem (Security.PrefetchSocketPolicy )
In testing, i got a error about corssdomain.
If each server's ip address is different....
If i call 'Security.PrefetchSocketPolicy', webplayer talk to me...
SecurityException: Unable to connect, as no valid crossdomain policy was found
my crossdomain policy ...
<cross-domain-policy> <allow-access-from domain="*" to-ports="*"/> </cross-domain-policy>
I made 'socket server' as follows... (client unity is webplayer version)
1) Policy-server : If unity API call policy, will send crossdomain plicy.
2) Login-server : check users login
3) Lobby-server : make room, play game
TEST 1
All servers located on same IP address (111.111.111.111)
load unity webplayer
API call 'Security.PrefetchSocketPolicy( 111.111.111.111, port)' to connect Login-server
Policy-server send policy packet.
connect Login-server and then... check login
And then... move Lobby-server
API call 'Security.PrefetchSocketPolicy( 111.111.111.111, port)' to connect Lobby-server
Policy-server send policy packet.
connect Lobby-server and then... make room and play.
TEST 2
1. It is same test flow. but server's IP address is different.
2. 'Policy-server' + 'Login-server' locate on 111.111.111.111
3. 'Policy-server' + 'Lobby-server' locate on 111.111.111.222
4. " load webplayer -> Policy-server -> Login-server " is success.
5. and then IP is change 111.111.111.111 -> 111.111.111.222
6. policy-server-> Lobby-server is fail.
"SecurityException: Unable to connect, as no valid crossdomain policy was found"*
"TEST-1" is success. (no problem)
"TEST-2" is fail.
I have a question.
If server's IP is different, what can adjust crossdomain policy ?
Thank you for read my question :)
Answer by Bunny83 · Jul 16, 2011 at 12:46 PM
I'm a bit confused by your explanations. If you have two different servers behind two different IPs and you want to connect to them, each server have to provide a cross-domain-policy. Are you sure that both servers provide the policy?
You only need to call Security.PrefetchSocketPolicy when you want to use a different port (not 843) for the policy check, otherwise Unity is fetching the policy automatically from the requested IP at port 843.
Also keep in mind that TCP connections need to check the policy only once. UDP will check the policy every packet that is send since it's connection-less. Using udp sockets in the webplayer is not really recommended ;)
http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html
Your answer
Follow this Question
Related Questions
Security.PrefetchSocketPolicy problem. 0 Answers
Web Player connection issue. 0 Answers
Policy File is being served, but never recognized 1 Answer
Yet another socket-and-crossdomain-policy question 1 Answer
Uniweb(sockets) + Facebook 0 Answers