Hello all;
I am writing a c# console application using unity api. When i try to connect to the smartfox, system hangs up at the handshake.
Log at the smartfox;
11 Mar 2011 17:57:31,812 INFO [com.smartfoxserver.v2.controllers.SystemController-1] v2.controllers.SystemController - {IN}: Handshake
11 Mar 2011 17:58:00,384 INFO [Scheduler1-thread-1] bitswarm.sessions.DefaultSessionManager - Session removed: { Id: 25, Type: DEFAULT, Logged: No, IP: 127.0.0.1:39268 }
Lof at the c# console;
[SFS -DEBUG] Handshake respınse : tk => smthingsmthing, ct => 1024
[SFS - ERROR] TCPSocketLayer: Connection closed by the remote side
So after a while after the handshake smartfox closes the connection and onConnection event is never triggered.
I managed to connect in Smartfox 1.6 the same way.( I've changed my code according to Smartfox2x of course. )
Anybody has an idea why this is happening?
Any help is appreciated.
Thank you.
Connection stops at handshake when trying to connect
-
ThomasLund
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
The typical scenario for this is, that you are running the API in "thread safe mode" - which is the default in the SFS2X API due to issues with Unity not being thread safe.
Either manually turn this off on your SmartFox instance - or set up a scheduled loop to trigger emptying the event queue.
/Thomas
Either manually turn this off on your SmartFox instance - or set up a scheduled loop to trigger emptying the event queue.
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
-
ThomasLund
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Ahhh - looking in the wrong end. Its a client side setting on the SmartFox instance.
by doing something like
Code: Select all
/// <summary>
/// When true (default) sets the API to be run with an event queue that needs to be processed from the client
/// </summary>
/// <remarks>
/// When run in Unity, this <b>has</b> to be true. Otherwise you will get random crashes.
/// </remarks>
/// <seealso cref="ProcessEvents"/>
public bool ThreadSafeMode {
Code: Select all
SmartFox sfs = new SmartFox();
sfs.ThreadSafeMode = false;
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund