l42111996 / java-Kcp

基于java的netty实现的可靠udp网络库(kcp算法),包含fec实现,可用于游戏,视频,加速等业务
Apache License 2.0
464 stars 140 forks source link

KCP Disconnected And Reconnected Frequently #37

Closed congcoi123 closed 5 months ago

congcoi123 commented 7 months ago

Hi,

Thank you for your contribution. I am integrating KCP into my game server, however, it is struggling with automatically disconnecting and reconnecting. There is no issue running it locally, but when I deployed the server to my VPS, the problem occurred. I've attached the log for that symptom.

Screenshot 2024-03-20 at 04 17 46

Would you happen to have any ideas on how to troubleshoot it?

congcoi123 commented 7 months ago

It seems there might be some issues occurred so the ukcp got closed. I will put some logs here and check. Let's see. image

congcoi123 commented 7 months ago

The issue comes from this FEC. I removed the library and am trying to retest it.

Screenshot 2024-03-20 at 21 14 21 Screenshot 2024-03-20 at 21 27 47
congcoi123 commented 7 months ago

@l42111996 I would like to raise a PR which is just for putting some reason logs when the connection gets disconnected. What do you think about it?

l42111996 commented 7 months ago

Can you provide the parameter information codes at both ends? Which library is used on the client side? fec is a function unique to this version, not a function of the original version of kcp. If the libraries used are inconsistent, it may be a problem with this parameter. Try disabling fec.

congcoi123 commented 7 months ago

Hi @l42111996, Thank you for the response. Both client and server are using the same Java library. The configuration is the same except the client does not need to declare the timeout.

Screenshot 2024-03-21 at 18 40 19

I disabled the FEC configuration and it's being tested on my game. Let's see how it performs.

Regarding the integration of KCP into my game server, here is the PR: https://github.com/congcoi123/tenio-core/pull/50/files

l42111996 commented 7 months ago

I guess it is not a problem with fec. Whether the connection to this library is available is based on the heartbeat timeout. For messages not included in the library, you need to write a heartbeat mechanism in the business layer. If no message is received within the TimeoutMills time, the library will Think the network has been disconnected

congcoi123 commented 7 months ago

If you check this screenshot, you may find the exceptional log. https://github.com/l42111996/java-Kcp/issues/37#issuecomment-2010629245

Your framework is in testing on my Android game, let's see how it works.

l42111996 commented 7 months ago

I'm on vacation. I'll take a look at this issue in a few days.

congcoi123 commented 7 months ago

I appreciate your time.

l42111996 commented 5 months ago

The problem has been fixed and the latest source code is used. The C language version used by fec by default. If the platform you are using does not compile the corresponding library, you can compile it yourself. I only tested successfully on the windows and arm macos platform. The warehouse address is https://github.com/l42111996/reedsolomon_jni

congcoi123 commented 5 months ago

@l42111996 Many thanks for your time 苗大哥 I will test it and update you.