EsotericSoftware / EsotericSoftware/kryonet
Kryonet disconnects just after connecting
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 411
- PR merge metrics
- No merged PRs in 30d
Description
_From [cai...@gmail.com](https://code.google.com/u/101276589749535757218/) on July 07, 2013 19:02:06_
What steps will reproduce the problem?
1. start a server
2. start client
3. client keep sendTCP to server
4. server not send anything to client
What is the expected output? What do you see instead?
[kryonet] Connection 1 connected: /127.0.0.1
[kryonet] Connection 1 disconnected.
in 12 seconds
What version of the product are you using? On what operating system?
2.20
Please provide any additional information below.
Reason and how to fixed it:
if i am keep writing lastWriteTime will bigger than the parameter "time" for method:
com.esotericsoftware.kryonet.TcpConnection.needsKeepAlive(long time);
so this will case "time - lastWriteTime" < 0 and of course made it < keepAliveMillis. That is why needsKeepAlive() will always return true, and client killed it by itself.
i fixed by adding such code in the needsKeepAlive() method and isTimedOut (long time) method, you can see details in attachment.
Hope this helpful!!
BTW your frame is great! and simple to use!!
**Attachment:** [compare.jpg](http://code.google.com/p/kryonet/issues/detail?id=34)
_Original issue: http://code.google.com/p/kryonet/issues/detail?id=34_
Contributor guide
Assessment
This issue has not been assessed yet.