简体   繁体   中英

What does Kryonet send over each couple seconds?

I noticed Kryonet sending/receiving an object I did not register to each connected member about every 5 seconds. It's probably just a couple byte and even for a couple thousand players would not up the server load much more then 1 kB/s but I need to know.

  • Why is this?
  • How large is this?
  • Can I stop it or slow down the interval?

I remember I have read something about this when I was fiddling with Kryonet a view years ago but I cannot find that article anymore.

To be clear, on the received override method in the Listener . I start receiving packets that I did not register once a client joins the server. The amount of packets being send and received by the server increases linearly with the amount of clients connected to the server.

Like EJP mentioned in the commend already it is some form of ping to keep the connection open. Here is the theory to why this behaviour happens (Disclaimer: I have no extended knowledge on the subject, yet) .

A TCP or UDP connection can stay open indefinitely but if neither the client nor the server communicates there is no way of knowing if the client (or server) has been disconnected. The constant pinging between client and server is called a heartbeat in this question .

So as far as I understand the Kryonet server will send an empty object to the client and the client should answer back. If the server does not receive an answer for a certain amount of time (I believe 5 seconds by default) the connection will be closed and other clients can be notified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM