Page 1 of 1

Set Client TCP Timeout

Posted: 24 Jul 2017, 15:52
by gemmountain
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!

Re: Set Client TCP Timeout

Posted: 25 Jul 2017, 06:50
by Lapo
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