Problem with bluebox connection (Unity3d)

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

Moderators: Lapo, Bax

COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Problem with bluebox connection (Unity3d)

Postby COB » 15 Jan 2011, 20:54

I am not able to make Unity application to connect to Smartfox through bluebox. At the moment I am using localhost and server is installed on the same machine. Bluebox is added to config and this page:
http://localhost:8080/BlueBox/
shows expected result.
I use SFSisland example as a base for my application.
I added these lines:

Code: Select all

smartFox.blueBoxIpAddress = "127.0.0.1";
smartFox.blueBoxPort = 8080;
smartFox.smartConnect = true;

before smartFox.Connect(serverIP, Convert.ToInt32(serverPort));
I tried to set serverPort to 9338 (wrong walue to trigger bluebox connection) or 8080, but it's not working and there is no connection at all. When I set port to standard 9339 everyhing is working fine. Do I have to make any other changes?
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 15 Jan 2011, 22:18

After some research I noticed that it is working with standalone build. Then I noticed that there is some problem with policy. Since now I had something like this:

Code: Select all

Security.PrefetchSocketPolicy(serverIP, 9339);

Without this line I can not connect to smartfox even using sockets. Unfortunately, bluebox works on different port, so I added next line:

Code: Select all

Security.PrefetchSocketPolicy(serverIP, 9339);
Security.PrefetchSocketPolicy(serverIP, 8080);

Now it works. However, I am not sure if this is a proper solution.
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 17 Jan 2011, 17:10

search for socket policy validation.
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 17 Jan 2011, 19:56

Generally Bluebox works now but not in the corporate network... At the moment I use port 9339 for Smartfox and 80 for Bluebox. It is possible to write:
http://SERVERIP:80/BlueBox/
and see successful screen from PC in corporate network. It is also possible to connect using Bluebox from PC not in the corporate network.
I use Wireshark to sniff the traffic, and I see that with this code:

Code: Select all

Security.PrefetchSocketPolicy(serverIP, 9339);
Security.PrefetchSocketPolicy(serverIP, 80);

application tries to get policy file from port 9339 (of course without success, no response), then port 80 (also no success - don't know why) and then 843 which is a standard port for policy files. I'm not sure, but maybe even when port 80 is used Unity tries to setup socket connection which is blocked somehow in this network? As far as I understand Bluebox puts all traffic in http. However http also uses TCP sockets in lower stack layer. Maybe some firewall filters all no http tcp traffic and when policy file is not downloaded through http it doesn't work? I have a filling that when application manages to get the policy file, everything will start working. Just this one step...
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 26 Jan 2011, 06:45

Yesterday I was going to solve the BlueBox vs corporate network issue, but unfortunately I noticed that now BlueBox is not working with standard internet connection or even on standard LAN. I am very confused and after some hours I still do not know why. Generaly web server is working and I can see BlueBox with: http://SERVERIP:80/BlueBox/ from remote machine. I even reinstalled SFS and after that I only changed port for Jetty from 8080 to 80, so SFS uses 9339 and BlueBox uses port 80. In Unity I prefetch the policy this way:
Security.PrefetchSocketPolicy(SERVERIP, 80);
I did not make any changes to policy file, so it contains:
<allow-access-from domain="*" />
I use wrong port in Unity (9338) to force it to use BlueBox.
When I run the application I can see in Wireshark (follow TCP stream option):

Code: Select all

<policy-file-request/>.HTTP/1.1 400 Bad Request

Connection: close

Server: Jetty(6.1.16)

As you can see there is a communication between application and Jetty, but I assume that there is a problem with getting the policy file, because I am quite sure that standalone application is working with BlueBox.
Also this URL:
http://hostname:port/BlueBox/HttpBox.do?debugCmd=main
debug_mode=true
shows no errors. (In bluebox.properties there is a small error -> HttbBox.go instead of HttbBox.do.)

At the moment I am very confused and do not know what can I do to make it work once again, so I will appreciate your help a lot.[/code]
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 27 Jan 2011, 07:11

Sorry about post under post, but today I noticed another very strange thing. When policy file is taken from the server I see:

Code: Select all

[SFS DEBUG] [ RECEIVED ]: <cross-domain-policy><allow-access-from domain='*' to-ports='9339' /></cross-domain-policy>, (len: 91)

no matter what I write in crossdomain.xml on my server. I change domain and add port but I always receive the same data. There is only one such file on my server in Server\webserver\webapps\root. It has to be cached somehow, because I can not find any other explanation.

Return to “BlueBox”

Who is online

Users browsing this forum: No registered users and 13 guests