I am confused with Security.PrefetchSocketPolicy call. Headachy some really!!
1. Only the Web Player is Evil some:
I use the photon as my game server which has its policy server on default port 843.
Then I connect to the server(use socket, you known). Everything works properly in Editor and StandAlone but the WebPlayer.
2. The IP and Port is OK
I am sure my fireworks not block the port 843, I turn them off. I can telnet the port and get the crossdomain string back successfully. either to the sockpol Server(offer by unity) or Photon policy server. All port and IP works perfectly except in Webplayer!
3.I do myself, but not work
The doucument from the Unity tell me I needn't call the Security.PrefetchSocketPolicy("172.16.0.111", 843, 300), eveything default will work for me. But in act it doesn't.
OK, no problem, I did it myself with the following code:
if (Global.Instance && !Global.Instance.Offline)
if (!Security.PrefetchSocketPolicy("172.16.0.111", 843, 300))
4. I try to change the port to 2018, this time is more strange, It doesn't work even in Editor
I change code to: if (!Security.PrefetchSocketPolicy("172.16.0.111", 2018, 300)) and change the photon policy listener port to 2018
I mean if I can call Security.PrefetchSocketPolicy("172.16.0.111", 843, 300) successfully, everything will be ok! But I never, never got the successful return. It is always print "PrefetchSocketPolicy failed!"
Pool man, I've work around it for 5 days, I test it , I try all suggestion from the warmhearted friends (etc: Tobias,). but it still stay there. The evil webplayer!!!!
Help me Pls. guy?
How can I me the Security.PrefetchSocketPolicy work in webplayer???????
What's the third parameter? I use this when I hit ElectroServer and it works just fine, although I never examine the value it returns:
Perhaps the problem is with your crossdomain? What are you delivering?
The third parameter is timeout is ms. I pass it as 300, 5000 or don't pass anything just like you. They don't work too.
But in webplayer, It won't send even if I add the code such as : Security.PrefetchSocketPolicy(ip, Convert.ToInt32(serverPort));
Only the web player.
I try use the default port 843 or custom port:2048. Both failed!!
Help me pls! Am I the only one met such a problem????
Maybe I don't explain my problem clear. So I attach my link about the same problem here:
You know, I am really need you help now. For my game could publish to the tester, just for this evil problem!!!!!!
Of course it would fail for your Web Player. The whole point of having the secure socket policy server is to prevent WEB PLAYER clients from accessing sites that shouldn't be accessible by users outside their intranet. So the cross domain files says I will allow this address on this port to be accessed by the web player. The Policy Server should run on the same box (same address) of the Game Server that is doing the hosting. The web player expects the policy server to be running on port 843. Unix machines would give you grief about reserved ports lower than 1024 as this needs to be run as root (not a problem for Windows). So Security.PrefetchSocketPolicy allows you to change the default setting to something higher than 1024 like 2048. But your photon policy server needs to actually run on 2048 or whatever secure socket policy server you have in place (like secpol.cs). The cross domain file would then name the actual game server port / range for connecting to your game server. Your game server port would not run on 2048 which is being occupied by the policy server...
You may face another problem... Your Server Name look up may return more than one ip addresses. This code gets around that issue.
- public string ipAddress = "www.mycomputer.com"; //"localhost";
- public int gamePort = 14248;
- public int policyPort = 8843;
- public void OnGUI()
- # if UNITY_WEBPLAYER
- bool isPolicyConnected = false;
- string hostname = gm.ipAddress;
- IPAddress ips = Dns.GetHostAddresses(ipAddress);
- foreach (IPAddress ip in ips)
- else break;
- else ipAddress=hostname;
- # else
God save me! Yeah!!!
I am so excited, almost bacchanal some!! Just for getting rid of the Web player policy EVIL. Good bye, Mr Evil!!! Aha!
So I am here, to tell the solution for the pool guy meets the same evil like me. I trace it for two weeks long. I means it is a period of hard time. It shouldn't be headache to you guys any more.
Very simple reason. In my scene there is dlls (I18N.dll, I18N.CLK.dll), these two dll is used to support the Simple Chinese Input in Unity version 2.6(in version3.0 up, we needn't them. ). the version of them is older some. They cause some crash we can't print, but they make my browser cant parse the policy request. So the on the server side, policy server never gets any request.
Evil's gone!!! The god sun's up!!!
Thanks for the guys reply the post!!!