Set Client TCP Timeout

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

Moderators: Lapo, Bax

gemmountain
Posts: 4
Joined: 17 Oct 2014, 17:23

Set Client TCP Timeout

Postby gemmountain » 24 Jul 2017, 15:52

Hi there,

I'm using Java Client API 1.6.1. When I enable lag monitor in client code like this:

Code: Select all

sfsClient.enableLagMonitor(true, 5, 10);

and then try to unplug network cable, I get following logs:

Code: Select all

16483 [New I/O client worker #1-1] INFO sfs2x.client.controllers.SystemController - Message: ResPingPong { Message id: 29 }
{ Dump: }
[ Empty SFSObject ]
21477 [Timer-0] INFO sfs2x.client.core.SFSIOHandler - Data written: Binary size: 20
12 00 03 00 01 61 03 00 1D 00 01 63 02 00 00 01    .....a.....c....
70 12 00 00                                        p...           

26477 [Timer-0] INFO sfs2x.client.core.SFSIOHandler - Data written: Binary size: 20
12 00 03 00 01 61 03 00 1D 00 01 63 02 00 00 01    .....a.....c....
70 12 00 00                                        p...           

31477 [Timer-0] INFO sfs2x.client.core.SFSIOHandler - Data written: Binary size: 20
12 00 03 00 01 61 03 00 1D 00 01 63 02 00 00 01    .....a.....c....
70 12 00 00                                        p...           

36475 [Timer-0] INFO sfs2x.client.core.SFSIOHandler - Data written: Binary size: 20
12 00 03 00 01 61 03 00 1D 00 01 63 02 00 00 01    .....a.....c....
70 12 00 00                                        p...           

40388 [Thread-6] ERROR sfs2x.client.core.sockets.TCPSocketLayer - TCPSocketLayer: Socket error: An existing connection was forcibly closed by the remote host
Connection lost.

In detail, I get the CONNECTION_LOST event 20s after unpluging network cable.

I tried to change the second parameter of enableLagMonitor function to 1 or 4, but I always get CONNECTION_LOST event after 20s.

I also read about unplug network cable on this forum (like this one: http://smartfoxserver.com/forums/viewto ... 18&t=19081)

But my question is how can I change the timeout value of client, in other words, I want to get the CONNECTION_LOST event sooner (5s for example)

Thank you in advanced!
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Set Client TCP Timeout

Postby Lapo » 25 Jul 2017, 06:50

Sorry its not possible for that particular scenario.
The timeout depends on your OS TCP stack and it can't be modified from our API.

Keep in mind that unplugging the cable does not simulate a disconnection over the Internet.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 11 guests