Blue Box and Unity Web Player

Submit all your BlueBox related questions or report a bug here!

Moderators: Lapo, Bax

sennin31
Posts: 10
Joined: 26 Jul 2011, 05:33

Blue Box and Unity Web Player

Postby sennin31 » 09 Jan 2012, 15:30

Hello,

I haven't found any solution on Google so I expose my issue here :

I'm trying to make blue box working with a simple web player demo, who is trying to connect to a SFS Pro, protected by a firewall.

On a standalone it's working :
The first request to SFS Pro on the default port (9339) timed out, because I haven't set an exception in my firewall, so it switch to bluebox. Then, the connection to bluebox works fine.

In a webplayer it's an other history :
The first request is send, SFS says "Trying to connect", and after nothing...no time out....

Here is my code for the connection :

Code: Select all

void Awake() {
      print("Start");
      Security.PrefetchSocketPolicy(ip, port);
      Security.PrefetchSocketPolicy(ip, blueboxport);
      if( ! SmartFox.IsInitialized() ) {
         try {
            smartFox = SmartFox.Connection = new SmartFoxClient(debug);
            smartFox.smartConnect = true;
            smartFox.httpPort = blueboxport;
            AddSfsEvent();
            smartFox.Connect(ip, port);
         }
         catch (Exception e) {
            errorMessage = e.ToString();
            print( errorMessage);
         }
      }
   }


Is anybody can help me?

Thanks,
Sennin
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 10 Jan 2012, 11:35

Does the prefetch policy command return true? In that it got the policy or not?

You can e.g. wrap the prefetch into a

if (Security.Prefetch....) { Connect } else { Write error message }

Additionally the prefetch can take a 3rd parameter that is a timeout. This gives it some time to negotiate. Try to set it to e.g. 500.

Generally the SFS1 API hasnt been worked upon for ages due to SFS2X. If you are starting up from scratch, I would suggest going with 2X instead.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
sennin31
Posts: 10
Joined: 26 Jul 2011, 05:33

Postby sennin31 » 10 Jan 2012, 12:34

ThomasLund wrote:Does the prefetch policy command return true? In that it got the policy or not?


Nope, the prefetch policy return false, and I don't know why, because both IP and port are Ok.

But despite that, it's strange that no time out append when I'm trying to connect.

ThomasLund wrote:Additionally the prefetch can take a 3rd parameter that is a timeout. This gives it some time to negotiate. Try to set it to e.g. 500.


Is this time out could run blue box? If not, what's the point of a time out in the prefetch policy?

ThomasLund wrote:Generally the SFS1 API hasnt been worked upon for ages due to SFS2X. If you are starting up from scratch, I would suggest going with 2X instead.


Hum, not a good news! I'm not starting from sratch, it's not my first projets with smartfox. I've got several extensions but it's my first try with blue box. What will be the incidence for me if I want to use 2X? I brought SFS Pro licence last year...

Thanks,
Sennin
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 11 Jan 2012, 10:07

Basically if your prefetch returns false, then the Unity webplayer will not allow _any_ networking to happen. So thats the reason nothing works for you.

The security policy negotiation is 100% a Unity thing and has nothing to do with the SFS API itself.

The timeout value allows Unity webplayer and the policy server to finish their negotiations before the rest of the code is executed. So try to stick in 500 milliseconds as the 3rd parameter and see if it doesnt return true then

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
sennin31
Posts: 10
Joined: 26 Jul 2011, 05:33

Postby sennin31 » 11 Jan 2012, 13:27

I've open the SFS port (9339) on my firewall and now prefetch returns True.

But I don't want to open that port in my Firewall.

I want Blue Box to bypass my firewall, but I can't get the crossdomain and the socket connection never time out.

Where could I put the crossdomain to get it, and why the socket connection never time out, in order to try the connection with blue box?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 12 Jan 2012, 21:47

I cant help you on why it doesnt time out - the network negotiation happens somewhere between Unity webplayer and your server.

You need to have the policy file accessible somehow on some port on the server - so you need to open that port to wherever your policy file is located. Thats just how it works.

But you can basically run a policy server on some other port - so not sure I understand the problem. Sorry

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund

Return to “BlueBox”

Who is online

Users browsing this forum: No registered users and 20 guests