EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.82k stars 419 forks source link

TCP timeout when using 3g #11

Closed ghost closed 10 years ago

ghost commented 10 years ago

From nep...@gmail.com on July 13, 2011 00:12:13

What steps will reproduce the problem? 1.connect the android phone client to a server with default tcp keep alive/timeout not changed

  1. use wifi, you will see no disconnects
  2. switch to 3g, and you'll see every 12 seconds there is a disconnect What is the expected output? What do you see instead? 3g should not disconnect every 12 seconds, as my connection is just fine. What version of the product are you using? On what operating system? 1.04 Please provide any additional information below. Although the cellphone's 3g connection isn't as stable as wifi, it is pretty stable for all the programs I use. Definitely shouldn't be considered timing out every 12 seconds, as set in the client/server .setTimeout() method. When using wifi for the client, it works perfectly...

Original issue: http://code.google.com/p/kryonet/issues/detail?id=10

ghost commented 10 years ago

From nathan.s...@gmail.com on July 25, 2011 23:38:53

Sorry for the delay. I need to get around to writing a test and seeing this for myself.

Status: Accepted

ghost commented 10 years ago

From nep...@gmail.com on July 25, 2011 23:49:32

Appreciate the time everyone involved put into this! You could see the logs.

Download the app https://market.android.com/details?id=org.lucius.antm And tail logcat with the tag "edz" while running the app with wifi, the switch to 3g and you will notice connection instability every several.seconds.

ghost commented 10 years ago

From johan.f....@gmail.com on August 28, 2011 03:03:37

Removed my comment as i figured out what causes it for me. I'm trying to send a compressed png over the network to my phone, if i comment that out it doesn't disconnect. If i keep the code in, it disconnects and never receives the packet at all. I'm guessing it has something to do with the amount of data being sent over the network.

ghost commented 10 years ago

From nathan.s...@gmail.com on April 25, 2012 20:31:29

Probably the buffer overflows because the network hardware buffer can't be emptied fast enough. Do you have an exception and stacktrace? KryoNet v2 has TcpIdleSender and InputStreamSender which can be used to send streams of data without huge buffer sizes.

Status: Fixed