how to handle server connection failure and try again later

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

Moderators: Lapo, Bax

nicolash
Posts: 12
Joined: 24 Oct 2011, 05:51
Location: France
Contact:

how to handle server connection failure and try again later

Postby nicolash » 24 Nov 2011, 13:14

Hello,

here's my usecase:
==
my java client tries to connect to the server
the server is not up, so i get a connection refused (from client boss)
the client tries to reconnect every 5 seconds to the server.
===

The issue is that i cannot use the same smartfox object to try to reconnect (erreor : A connection attempt is already running), i can't disconnect it because it's not connected and It doesn't try to reconnect itself on his own

So I create a new one, which later on creates some Threads from your thread pool (ie previous sfs are never garbage collected), the problem is that those threads are always reacheable from GC root and never desallocated. I end up with a clutter of useless thread waiting


Any idea how to achieve what I want to do ?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 28 Nov 2011, 13:49

Could you try to force bluebox to false - and see if that makes you able to reconnect?

sfs.setUseBlueBox(false)

I can see in the API that there connection flag isnt reset when it has the possibility to fallback to blue box.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
nicolash
Posts: 12
Joined: 24 Oct 2011, 05:51
Location: France
Contact:

Postby nicolash » 28 Nov 2011, 14:15

that does the job, thanks!
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 28 Nov 2011, 15:48

Super - will add bug to bugtracker for the general case. Thanks for reporting
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 12 guests