Lobby (Unity) example partly fails

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

CaptainBob
Posts: 2
Joined: 16 Apr 2013, 10:57

Lobby (Unity) example partly fails

Postby CaptainBob » 26 Apr 2013, 14:14

This is probably a true newbie error. I'm just learning both Unity and SmartFoxServer 2x.

I'm trying to work through the examples to confirm that they work and that my remote Ubuntu server is set up correctly. (Actually, I had SmartFoxServer consultants set up the server and install SmartFoxServer, so it's probably mostly OK except for something I can configure.)

I can get the first Unity example, a basic CONNECTOR, to work fine, both on my Windows 7 (64-bit) Dell with Apache2 and the latest version of SFS2X. Even the second example, "LOBBY" works fine on the Windows 7 laptop, run with server=127.0.0.1 and accessed from two different accounts, "we" can create a lobby, see each other in the list of users, and exchange messages.

So, the basic CONNECTOR code is working.

I opened the project in Unity and changed the hard-coded server address from "127.0.0.1" to "vm22.isointeractive.com", and rebuilt the Unity WebPlayer build. (This is exactly what I had just done successfully for the CONNECTOR example.)

Then I copied the 2 built files to the webserver root (htdocs) folder on my remote server, the same folder containing index.html and the connector.html file (and unity3d file) that works fine from there.

Here's the results:

* If I access the remote server from two different accounts on my laptop, using FireFox current version as a browser, the LOBBY example works fine, as it did locally. My two users can see each other, exchange messages, etc.

* If I access the remote server ( "http://vm22.isointeractive.com/weblobby.html") from a different computer running Windows XP and Firefox, it connects fine and shows the GUI, but appears to be unaware that anyone else is present. The session cannot see other user sessions, and they cannot see it.

* If I TRY to access the exact same remote server address "http://vm22.isointeractive.com/weblobby.html" from my Macbook Pro running Snow Leopard and Firefox, I get the first GUI box and an "unable to connect" error.

POSSIBLY related to the above problem, but certainly making it more difficult to trace, there seems to be something wrong with my settings for the DEBUG LOG file writing.


On the fully-working client, run locally, I have logs and can view them in the administrative app, but none of the debug comments seem to make it to the logs. They just show connections and disconnections, not the step by step commentary in the example.

On the remove server, the run-time log is entirely blank. Even connections and disconnections do now show up. Zip.

Any ideas would be appreciated of what to try next. Thank you!
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Lobby (Unity) example partly fails

Postby Lapo » 26 Apr 2013, 16:07

Hi,
(NOTE: I moved the post in the proper Unity section)
I tested your online experiment -> http://vm22.isointeractive.com/weblobby.html
and it's not working correctly because it's pointing to 127.0.0.1

All you need to do is checking the Player.log file that Unity generates, you will notice this:

Code: Select all

SocketPolicyClient1: About to BeginConnect to 127.0.0.1:9933
SocketPolicyClient1: About to WaitOne
SocketPolicyClient1: Caught exception: Connection refused
Security Exception. Policy file load failed!
...
...
SocketPolicyClient2: About to BeginConnect to 127.0.0.1:843
SocketPolicyClient2: About to WaitOne
SocketPolicyClient2: Caught exception: Connection refused
[SFS - ERROR] TCPSocketLayer: General exception on connection: Unable to connect, as no valid crossdomain policy was found   at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32& error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
  at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0
[SFS - DEBUG] [ BB-Connect ]: http://127.0.0.1:8080/BlueBox/BlueBox.do
[SFS - DEBUG] [ BB-Send ]: null|connect|null


Which means that the client is really not pointing to the live server, which in turn explains the other problems.
To check the logs see here:
http://docs.unity3d.com/Documentation/M ... Files.html
Lapo
--
gotoAndPlay()
...addicted to flash games
CaptainBob
Posts: 2
Joined: 16 Apr 2013, 10:57

Re: Lobby (Unity) example partly fails

Postby CaptainBob » 26 Apr 2013, 19:08

OK, I'm obviously mis-understanding something very basic about the relationship between computers, servers, clients, Unity and SmartFoxServer.

The unity documentation you pointed me to describes where on windows and macs to find the unity log, but I wouldn't think either of those is involved here.

I started by loading Unity on a Windows 7 laptop, where I also downloaded the Unity Examples for SmartFoxServer examples "connector" and "lobby".

I opened Unity, imported the connector project, edited the loginGUI C# file or whatever it is to change 127.0.0.1 to "vm22.isointeractive.com", and "built" a web-player project. (I fixed my problem before which invovled commenting out the wrong line.)

That resulted in two files being created on the Windows computer: bestlobby.html, and bestlobby.unity3d.

THEN, I sftp'd those two files up to an UBUNTU server off in Atlanta, which has SmartFoxServer2x installed on it.
I put those two files into the apache2 document root directory: the <username>/public_html directory.

THEN I fire up my Macintosh, say, open a firefox web browser, put in the URL:
http://vm22.isointeractive.com/bestlobby.html,
which brings up the start of the first screen, then fails with an unable to connect error.

So, where, exactly should the Unity Web-Player Log file be? UP on the Ubuntu web-server box somewhere?
On my local mac that I tried to access the web page from? On the Windows laptop that I used to create the webplayer module?

Where did YOU look to see the error message you told me about? Surely not on any of those three boxes!

I apologize for being overwhelmed and in too-much-info shell-shock right now. It will pass once I can ever get the very simple examples to actually work.

Captain Bob
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Lobby (Unity) example partly fails

Postby Lapo » 26 Apr 2013, 21:43

So, where, exactly should the Unity Web-Player Log file be? UP on the Ubuntu web-server box somewhere?

No, the webplayer runs your machine, therefore the logs are on your machine.

On my local mac that I tried to access the web page from?

YES!

In addition to that it's not sufficient to change the host/port in the code because those public variables are actually bound to the Unity Editor.
This is what you need to do:

1- Load the Lobby example in the Editor
2- From the Project View navigate to Assets/Scenes/ and double click the lobby scene
3- In the Hierarchy panel click the Lobby GUI object
4- In the Inspector you will find the access to those public variables which you can change.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Lobby (Unity) example partly fails

Postby Lapo » 26 Apr 2013, 21:45

Visually it is this panel:
Schermata 2013-04-26 alle 23.26.05.png
(32.46 KiB) Not downloaded yet
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 62 guests