Connection lost issue

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

Moderators: Lapo, Bax

glebyama
Posts: 5
Joined: 08 Dec 2016, 08:04

Connection lost issue

Postby glebyama » 11 Apr 2017, 09:23

Hello.
We are developing an application for Android and we have an issue with restoring connection after it is lost. Issues happen when user switches wi-fi off, how should we handle such case correctly? We need to keep user on server as long as possible.
Technically, device should move to mobile internet and connection should restore but it does not happen. We only see CONNECTION_RETRY event on client and nothing else happens.
When connection is restored, there is an exception on server: SessionReconnectionException: Session Reconnection failure. The passed Session is not managed by the ReconnectionManager: java.nio.channels.SocketChannel
Can you please advise.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection lost issue

Postby Lapo » 11 Apr 2017, 15:16

Hi,
when switching network it's not possible to maintain the same connection because physically the client is closing the old TCP connection and opening a new one from a different IP address.

Best idea in this case is to handle the system event notifying the network switch and manually start a new connection.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
glebyama
Posts: 5
Joined: 08 Dec 2016, 08:04

Re: Connection lost issue

Postby glebyama » 12 Apr 2017, 07:09

Why then CONNECTION_LOST does not work? I assume, it should work when "User reconnection timeframe" is over but it does not happpen. Also, is it possible to call killConnection() to make reconnect establish a new connection automatically? Or is it better to call disconnect and then connect?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection lost issue

Postby Lapo » 12 Apr 2017, 07:48

CONNECTION_LOST may or may not fire based on the conditions of the underlying TCP stack.

Try pulling the ethernet cable off of your network card and be prepare to be amazed... nothing happens, no app will react. (the same goes for wifi)
We have discussed it here a hundred times, so I am not going to repeat it, but you can check this resource:
https://superuser.com/questions/911808/ ... rnet-cable
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 45 guests