SocketPolicyServer Trouble!

Everyone,

Does anyone have an example of using .NET Async sockets and the SocketPolicyServer? We are having no luck to make this work properly.

We have a small socket server that the Unity app connects and receives data from. This of course works in standalone builds.

With 3.0 we understand that Unity will, prior to allowing a socket connection, attempt to connect on the target at port 843, and send a request, and await a policy file. If the policy file is valid and the port is allowed then the socket can be opened…

But here’s what happens to us:

  1. Standalone builds all is well…
  2. When run thru the web player we see the 843 connection, we receive a proper policy request, and we send a proper policy response… But nothing works…
  3. We run in the editor with build target = Web Player ALL IS WELL!

As an attempt to debug we check for Application.webSecurityEnabled prior to our socket open attempt and if = true we explicitly call Security.PrefetchSockeyPolicy on our socket server IP, using port 843…

This WORKS in the editor. We detect that security is enabled, we do the prefetch which returns true, indicating success! The game proceeds with us receiving message streams from our socket server…

BUT in the WebPlayer this FAILS!!! We never get any data form our socket server.

FYI… We simply integrated the sockpol.cs class into our code, so it should be a proper policyserver… Also, we have tried the exact same test running SockPol.exe (disabling our built in policy server) but unfortunately with the exact same results.

So, what’s up? Do I have to hop on one leg and kill chickens!

Anyone got an idea?

Is this a bug in 3.01f4 WebPlayer?

I am at wits end… and I need this ability, so any help or suggestions would be greatly appreciated!

Thanks in advance,

Chris Aiken
Aiken Development/AikenLabs

The socket server is at an external place or alike? (I ask to rule out that its on localhost / 127.0.0.1 which I would suspect is hopefully disabled completely)

Dreamora,

The socket server is on a remote machine, on the same IP scope. As a side note, is it NOT allowed to have the socket server on LocalHost?

In the end, in most cases it would run on the local machine, but just now I am testing on a separate dev machine on the internal network.

Regards,

Chris