Error attempting multiple connections

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

Moderators: Lapo, Bax

Zaddo
Posts: 4
Joined: 25 Apr 2012, 11:26

Error attempting multiple connections

Postby Zaddo » 25 Apr 2012, 12:10

I am a newby to both Unity and SmartFoxServer. I have had some success making a multiplayer game and connecting to the server running locally on my development PC.

I am using the sample scripts and integrating them into my game.

The logs below show a problem I get when I try to connect to the server, when it has not been started, then start it, then try to connect again. The OnConnection event comes back very quickly first time if I do or don't have a server running. However, if I try to connect a 2nd time after server has started, it takes several minutes for the failed connection event to fire back. The second time it comes back it should connect successfully, as the server has now started. I cannot identify the problem from the available diagnostics I have at hand. Any ideas or pointers for further investigation will be much appreciated.

As you can see from below cut'n'past the server receives the request to connect. However the client

| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.0.1 ]

21:50:23,863 INFO [main] v2.SmartFoxServer - SmartFoxServer 2X (2.0.1) READ
Y!
21:50:32,943 INFO [SocketReader] core.SocketAcceptor - Session created: { I
d: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:51120 } on Server port: 9933 <---
> 51120

======================================================================
Unity Console Debug messages
=====================================================================
[SFS DEBUG] [ BB-Connect ]: http://127.0.0.1:9933/BlueBox/BlueBox.do
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

[SFS DEBUG] [ BB-Send ]: null|connect|null
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

[SFS DEBUG] ## BlueBox Error: Error during http response: connection closed by remote side
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

On Connection callback got: False (error : <>)
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnConnection(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:211)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

[SFS DEBUG] [ BB-Connect ]: http://127.0.0.1:9933/BlueBox/BlueBox.do
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

[SFS DEBUG] [ BB-Send ]: null|connect|null
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)


[SFS DEBUG] ## BlueBox Error: Error during http response: connection closed by remote side
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnDebugMessage(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:237)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)

On Connection callback got: False (error : <>)
UnityEngine.Debug:Log(Object)
ConnectionGUI:OnConnection(BaseEvent) (at Assets/Lobby/Scripts/ConnectionGUI.cs:211)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionGUI:FixedUpdate() (at Assets/Lobby/Scripts/ConnectionGUI.cs:66)
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Error attempting multiple connections

Postby rjgtav » 25 Apr 2012, 20:41

Hi.
Are you running both the server and the Unity Client on the same PC?
If so, please make sure that the server isn't being blocked by a firewall...
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Jake-GR
Posts: 59
Joined: 28 Dec 2011, 22:52

Re: Error attempting multiple connections

Postby Jake-GR » 25 Apr 2012, 21:52

Also if you don't have BlueBox configured correctly, the first attempt at connection uses the "socket" method. However the API does NOT reset the connection method ever, so connection attempts after the first will always use "http" (BlueBox).

There are 3 solutions that I know of:
1) Configure BlueBox correctly, this should be done if you plan on using it (fyi, it will use 2 CCUs per client)
2) Destroy the SF object (in Unity) and create a new one when you need to reconnect (to force socket method again)
3) Disable BlueBox on the Unity API, this is the easiest, but only do this if you do not plan on using BlueBox at all
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: Error attempting multiple connections

Postby ThomasLund » 27 Apr 2012, 10:07

Jake already gave the best answers.

Your client jumps into bluebox mode and will stay there forever. If BB isnt configured - bummer.

/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 “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 72 guests