Disconnecting properly in Unity

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 06 Oct 2010, 12:06

Hmmmmm - example 2 right?

I've just tried the exact same thing (except the UDP part) on the vanilla example.

Login, chat a few lines with the other one (got it running in editor + standalone), click logout and either quit (in standalong) or press play to stop (in editor). Unity 3 f5 on Mac.

Not a single crash on disconnect.

Get this in the editor log - so nice and clean shutdown. What is different in your setup? (BTW you arent using UDP in the lobby example as everything there runs without extension)

Code: Select all

[SFS DEBUG] <<< Packet Complete >>>
 
(Filename: /Applications/buildAgent/work/68355d6e5d19d587/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 2535)

[SFS - INFO] Message: Logout { Message id: 2 }
{ Dump: }

    (utf_string) zn: SimpleChat

[SFS DEBUG] Message: Logout { Message id: 2 }
{ Dump: }

    (utf_string) zn: SimpleChat

 
(Filename: /Applications/buildAgent/work/68355d6e5d19d587/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 2535)

OnLogout
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
LobbyGUI:OnLogout(BaseEvent) (at Assets/Game/Scripts/LobbyGUI.cs:122)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
LobbyGUI:FixedUpdate() (at Assets/Game/Scripts/LobbyGUI.cs:71)
 
(Filename: Assets/Game/Scripts/LobbyGUI.cs Line: 122)
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 06 Oct 2010, 12:27

Yes, example 2.
I just took out all references to UDP. I am back to the original Lobby example. Same problem.

This is my editor output,

Code: Select all

OnLogout
UnityEngine.Debug:Log(Object)
LobbyGUI:OnLogout(BaseEvent) (at Assets/Game/Scripts/LobbyGUI.cs:152)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
LobbyGUI:FixedUpdate() (at Assets/Game/Scripts/LobbyGUI.cs:89)


I left out one step. After you stop the editor, press the play button again.

EDIT: Or also try to close the editor. It crashes on my system. I also have a MAC and will try it there later.

Steve
tpenn
Posts: 95
Joined: 03 Aug 2010, 18:48

Postby tpenn » 06 Oct 2010, 20:37

I was experiencing similar issues, which the posted .dll appears to have resolved. Thank you Thomas; I have much happier co-workers now. It's great not having to re-start Unity every other time running the game.

Hopefully you can find what continues to plague stevets.

For what it's worth, we're running Windows 7 here, so I don't think it's a Mac vs. PC issue.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 06 Oct 2010, 20:48

Phew - happy that it helped someone!!

If any of you have other areas where things work half or not at all - please report asap, so I can do something about it. Else I only find things where I use the API myself.

/Thomas
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 06 Oct 2010, 21:56

I am running Windows Vista 64bit on two computers. The problem I am having occurs on both computers. I am using IE8 on one and IE9 on the other.
Just some more info. Does anyone else use Vista 64 bit?

Thanks,
Steve
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 07 Oct 2010, 05:02

The rude, but "I need to ask" question would be, if you are 110% certain you copied the right dll to the right place.

No need to answer it, but please try to redownload and replace. Could be anything from buffered downloads to by mistake grabbing an earlier downloaded dll to copying the dll to a wrong place.

Next up - error messages. Anything from editor.log or player.log with an error in it.

Really been trying to provoke an error on disconnect with this one without luck - so need some help from you to reproduce to be able to fix

/Thomas
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 07 Oct 2010, 11:31

I checked and the dll I am using is your latest version.

The only real annoying problem I am having is the editor crashing when I stop the play button. I'm very happy with the fixes. I will dig deeper and see what other info I can find.

Thanks,
Steve
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 07 Oct 2010, 11:35

Definitely should not be there (any crash) - so has to be found. Any info from you will be helpful

/Thomas
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 09 Oct 2010, 18:12

Thomas,
Sorry for the late reply.

I have tried the same Unity3D example #2 (Lobby) on my Mac Mini and I do not have any problems when I stop the play button. I can press the play button again, right away, and the Lobby example works.

I still have the problem with both my laptop and desktop running Vista64 bit. I start the Lobby example and stop it with the play button in the editor. The Editor locks up immediately. If I wait until the server times out the session, then I can run the Lobby example without a problem.

I am not sure this is a smartfox server problem. The same Lobby code works in the Mac Mini, but fails in the Vista 64 bit.

It appears that Unity, under Vista 64bit, is not shutting down the tcp socket link when I press the play button to stop the Lobby program. Only after the server times out the session, does the Editor return.

I think I need to report this bug at the Unity site.

Thanks,
Steve
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 10 Oct 2010, 08:51

Would be super if you could file a bug report in the Unity end to start with.

Poke me when/if there comes an answer

/Thomas
User avatar
copet80
Posts: 42
Joined: 27 Apr 2010, 22:23
Location: Australia
Contact:

Re: Disconnecting properly in Unity

Postby copet80 » 06 Mar 2013, 01:57

I'm experiencing the same problem and I'm using Unity Pro 3.5.f6.

Scenario #1:
1. Hit the play button in Unity editor and login screen appears
2. Stop the test.

Log:
gui_Login.RegisterSocketClientListeners()
UnityEngine.Debug:Log(Object)

SocketClient.OnApplicationQuit: Application quits
UnityEngine.Debug:Log(Object)

SocketClient.Disconnect: Disconnecting...
UnityEngine.Debug:Log(Object)

gui_Login.OnApplicationQuit: Application quits
UnityEngine.Debug:Log(Object)

gui_Login.DeregisterSocketClientListeners()
UnityEngine.Debug:Log(Object)


Scenario #2:
1. Hit the play button in Unity editor and login screen appears
2. Login and connect to SFS
3. Stop the test.

Log:
gui_Login.RegisterSocketClientListeners()
UnityEngine.Debug:Log(Object)

SocketClient.Connect: Connecting...
UnityEngine.Debug:Log(Object)

SocketClient.OnConnection: Successfully connected
UnityEngine.Debug:Log(Object)

SocketClient.OnLogin: [User: test, Id: 16, isMe: True]
UnityEngine.Debug:Log(Object)

SocketClient.onRoomJoin: Room join successful
UnityEngine.Debug:Log(Object)

gui_Login.OnRoomJoin: E_Plaza
UnityEngine.Debug:Log(Object)

In Scenario #2, the OnApplicationQuit for both gui_Login and SocketClient never got called.

I'm aware that the last thread of conversation was 2010 and I'm hoping that this issue is already fixed or if someone knows a workaround for it.

Thanks!
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Disconnecting properly in Unity

Postby Lapo » 06 Mar 2013, 10:15

You are probably running some old version of the API?
Make sure to download the latest release from here:
www.smartfoxserver.com/download/sfs2x#p=updates
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Aldenea, DavinVicy, DerikFent, JerodSa, Kevengar and 33 guests