Some questions about Client lost connection

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

Moderators: Lapo, Bax

winson
Posts: 13
Joined: 06 Mar 2014, 07:08

Some questions about Client lost connection

Postby winson » 14 Aug 2017, 06:32

Recently,I confused some problems about client(unity) lost connection.

For example,normally I connect to the server with Wi-Fi,but maybe the network is not stable,or maybe the Wi-Fi is lost and then the phone change to use Cellular network automatically, or other reasons,the client lost the connection to the server without any notify.I have added the listener on OnConnectionLost,but the method is not be called.

So,I want to know,when the connection is lost,how can I know?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Some questions about Client lost connection

Postby Lapo » 14 Aug 2017, 07:50

Hi,
this has been discussed many times. See here:
viewtopic.php?f=18&t=18503&p=80840#p80840
viewtopic.php?f=18&t=19711&p=85173#p85173

Bottom line: switching network doesn't necessarily trigger a disconnection event. You will need to listen for specific events that tell you when the network switch happens. I am not sure if Unity provides them, probably it does but I am not a Unity expert. Sorry. I'd recommend checking their documentation.

If you can detect the network change you can delete disconnect the current SmartFox connection and create a new one.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 78 guests