No Client Notification when Server goes Away

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

homerlex
Posts: 48
Joined: 16 Aug 2012, 15:13

No Client Notification when Server goes Away

Postby homerlex » 18 Oct 2012, 11:40

SFS: 2.3.0
Client: 1.0.1

I have a Java client listening for Connection Lost:
sfsClient.addEventListener(SFSEvent.CONNECTION_LOST, this);

This seems to work fine when the server disconnects the user (after a timeout). However, if the server crashes (or goes down for whatever reason) the client gets no notification. I do see the following messages logged by the API client but no events make it to my app:

07:31:01,423 ERROR [New I/O client worker #1-1] sockets.TCPSocketLayer - TCPSocketLayer: Socket error: An existing connection was forcibly closed by the remote host
07:31:01,424 INFO [New I/O client worker #1-1] core.EventDispatcher - Dispatching event OnError to 1 listeners
07:31:01,424 INFO [New I/O client worker #1-1] core.EventDispatcher - Dispatching event ioError to 1 listeners
07:31:01,424 INFO [New I/O client worker #1-1] core.EventDispatcher - Dispatching event OnDisconnect to 1 listeners

I tried adding a listener like this but it doesn't do anything:
sfsClient.addEventListener("OnDisconnect", this);

Is there any way to detect a lost connection for this kind of condition so that we can initiate a reconnect?
User avatar
Lapo
Site Admin
Posts: 21012
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: No Client Notification when Server goes Away

Postby Lapo » 26 Oct 2012, 10:29

We have just released an update (v 1.0.4) --> you can get it here: http://www.smartfoxserver.com/download/sfs2x#p=updates
It should solve your problem.

Let me know how it works for you

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
homerlex
Posts: 48
Joined: 16 Aug 2012, 15:13

Re: No Client Notification when Server goes Away

Postby homerlex » 26 Oct 2012, 11:43

Works perfectly. Thanks!

Lapo wrote:We have just released an update (v 1.0.4) --> you can get it here: http://www.smartfoxserver.com/download/sfs2x#p=updates
It should solve your problem.

Let me know how it works for you

Cheers
User avatar
Lapo
Site Admin
Posts: 21012
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: No Client Notification when Server goes Away

Postby Lapo » 26 Oct 2012, 13:50

Excellent, thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest