[SFS - INFO] Message: Handshake { Message id: 0 }

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

Moderators: Lapo, Bax

Post Reply
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

[SFS - INFO] Message: Handshake { Message id: 0 }

Post by mmilen »

Just updated my .NET / WPF desktop application to the latest release SFS C# client dll build #1.7.13. Nothing works.

First, the new dll failed to read the configuration file. Note Just before the update it was all good, and the current production App has no problem with the connection from the same Windows 10 system. The production SFS server is 2.14, the dev SFS server is 2.15. No luck with either.

Second I did try to specify connection configuration in code.

sfsClient = new SmartFox(true);

sfsClient.AddEventListener(SFSEvent.CONFIG_LOAD_FAILURE, onConfigLoadFailure);
sfsClient.AddEventListener(SFSEvent.CONFIG_LOAD_SUCCESS, onConfigLoadSuccess);

sfsClient.AddEventListener(SFSEvent.CONNECTION, OnConnection);
sfsClient.AddEventListener(SFSEvent.CRYPTO_INIT, OnCryptoInit);
sfsClient.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
sfsClient.AddEventListener(SFSEvent.LOGIN, OnLogin);
sfsClient.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);
sfsClient.AddEventListener(SFSEvent.LOGOUT, OnLogout);
sfsClient.AddEventListener(SFSEvent.PING_PONG, OnPingPong);

sfsClient.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage);
sfsClient.AddEventListener(SFSEvent.PRIVATE_MESSAGE, OnPrivateMessage);

sfsClient.AddEventListener(SFSEvent.ROOM_JOIN, OnJoinRoom);
sfsClient.AddEventListener(SFSEvent.ROOM_JOIN_ERROR, OnJoinRoomError);
sfsClient.AddEventListener(SFSEvent.ROOM_CREATION_ERROR, OnCreateRoomError);
sfsClient.AddEventListener(SFSEvent.EXTENSION_RESPONSE, onExtensionResponse);

sfsClient.AddEventListener(SFSEvent.USER_ENTER_ROOM, OnUserEnterRoom);
sfsClient.AddEventListener(SFSEvent.SPECTATOR_TO_PLAYER, OnUserEnterRoom);
sfsClient.AddEventListener(SFSEvent.PLAYER_TO_SPECTATOR, OnUserToSpectator);

sfsClient.AddEventListener(SFSEvent.USER_EXIT_ROOM, OnUserLeaveRoom);
sfsClient.AddEventListener(SFSEvent.USER_COUNT_CHANGE, OnUserCountChange);

sfsClient.AddEventListener(SFSEvent.ROOM_ADD, OnRoomAdded);
sfsClient.AddEventListener(SFSEvent.ROOM_REMOVE, OnRoomDeleted);
sfsClient.AddEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE, OnRoomGroupSubscribe);

sfsClient.AddEventListener(SFSEvent.INVITATION, OnInvitation);
sfsClient.AddEventListener(SFSEvent.INVITATION_REPLY_ERROR, OnInvitationError);
sfsClient.AddEventListener(SFSEvent.INVITATION_REPLY, OnInvitationReply);

sfsClient.AddEventListener(SFSEvent.ROOM_VARIABLES_UPDATE, OnRoomVariableUpdate);

sfsClient.AddEventListener(SFSEvent.OBJECT_MESSAGE, OnObjectMessage);
sfsClient.AddEventListener(SFSEvent.ADMIN_MESSAGE, OnAdminMessage);
sfsClient.AddEventListener(SFSEvent.MODERATOR_MESSAGE, OnModeratorMessage);

sfsClient.AddEventListener(SFSEvent.USER_VARIABLES_UPDATE, OnUserVariablesUpdate);
sfsClient.AddEventListener(SFSEvent.USER_FIND_RESULT, OnUserFindResult);

sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_MESSAGE, OnBuddyMessage);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_ADD, OnBuddyAdd);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_REMOVE, OnBuddyRemove);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_ERROR, OnBuddyError);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_LIST_INIT, OnBuddyListInit);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_BLOCK, OnBuddyBlock);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_ONLINE_STATE_UPDATE, OnBuddOnlineStateUpdate);
sfsClient.AddEventListener(SFSBuddyEvent.BUDDY_VARIABLES_UPDATE, OnBuddyVariableUpdate);

sfsClient.AddLogListener(LogLevel.ERROR, OnDebugMessage);

Sfs2X.Util.ConfigData cfg = new Sfs2X.Util.ConfigData();
cfg.Host = "192.168.80.118";
cfg.Port = 9933;
cfg.HttpsPort = 8443;
cfg.HttpPort = 8080;
cfg.BlueBox.PollingRate = 500;
cfg.BlueBox.IsActive = true;
cfg.Zone = "EmaBridge_Teacherl";
cfg.Debug = true;
sfsClient.SetClientDetails("Windows", Environment.OSVersion.ToString());
sfsClient.SetReconnectionSeconds(20);

sfsClient.Connect(cfg);

This time connection died at handshake. OnConnection did not fire, I have registered a listener. I suspect I'm not calling it all from proper
The debug log below:

[SFS - INFO] Data written: Binary Size: 80
12 00 03 00 01 63 02 00 00 01 61 03 00 00 00 01 .....c....a.....
70 12 00 02 00 03 61 70 69 08 00 06 31 2e 37 2e p.....api...1.7.
31 33 00 02 63 6c 08 00 27 57 69 6e 64 6f 77 73 13..cl..'Windows
3a 4d 69 63 72 6f 73 6f 66 74 20 57 69 6e 64 6f :Microsoft.Windo
77 73 20 4e 54 20 36 2e 32 2e 39 32 30 30 2e 30 ws.NT.6.2.9200.0

[SFS - INFO] Data Read: Binary Size: 80
80 00 4d 12 00 03 00 01 70 12 00 03 00 02 63 74 ..M.....p.....ct
04 00 00 04 00 00 02 6d 73 04 00 07 a1 20 00 02 .......ms.......
74 6b 08 00 20 30 63 36 31 35 64 65 30 61 66 66 tk...0c615de0aff
63 39 62 63 31 38 66 31 31 30 61 64 61 61 65 36 c9bc18f110adaae6
34 32 35 62 35 00 01 61 03 00 00 00 01 63 02 00 425b5..a.....c..

[SFS - INFO] Message: Handshake { Message id: 0 }
{ Dump: }

(int) ct: 1024
(int) ms: 500000
(utf_string) tk: 0c615de0affc9bc18f110adaae6425b5
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: [SFS - INFO] Message: Handshake { Message id: 0 }

Post by mmilen »

Further, I switched back to 1.7.8.1 and no trouble. Dev server has no crypto, production is crypto enabled.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [SFS - INFO] Message: Handshake { Message id: 0 }

Post by Bax »

Hello.
This seems to be a thread-mode issue.
Make sure you set the SmartFox.ThreadSafeMode property explicitly to false during the configuration step:
http://docs2x.smartfoxserver.com/api-do ... 122431.htm

About the issue when loading the configuration file, does Unity throw an error? Can you show the full stack trace? Thanks.
Paolo Bax
The SmartFoxServer Team
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: [SFS - INFO] Message: Handshake { Message id: 0 }

Post by mmilen »

Thank you for the quick replay.
One suggestion add a quick note about it to this URL : http://docs2x.smartfoxserver.com/Gettin ... api-csharp

Best Regards
Milen
coolboy714cp
Posts: 323
Joined: 06 Feb 2010, 02:45
Contact:

Re: [SFS - INFO] Message: Handshake { Message id: 0 }

Post by coolboy714cp »

mmilen wrote:Thank you for the quick replay.
One suggestion add a quick note about it to this URL : http://docs2x.smartfoxserver.com/Gettin ... api-csharp

Best Regards
Milen
I agree, the SmartFox.ThreadSafe for UWP projects should be edited onto that page. I actually just had a similar issue till I saw this forum post.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [SFS - INFO] Message: Handshake { Message id: 0 }

Post by Bax »

Thank you for the suggestion. We added a note on that page.
Paolo Bax
The SmartFoxServer Team
Post Reply