Matrix-Zhang / tokio_kcp

A Kcp implementation for tokio
MIT License
176 stars 44 forks source link

Is it possible to provide an API that actively switches the underlying udp connection? #25

Open aa51513 opened 1 year ago

aa51513 commented 1 year ago

The underlying transport protocol of kcp implemented by this crate is udp

I found a phenomenon during actual use: for the same udp connection (UDP data channel determined by source IP and source port and destination IP and destination port), the speed is normal for a period of time after the connection is established,

but As the connection duration increases, the transfer speed will drop so drastically that it is almost unusable (and not blocked)

Since the connection isn't blocked and the program doesn't try to create a new connection, this puts me in a bind - can only use a very low connection speed until I restart the app, then wait for the connection speed to fail again and start a new lap

So I would like to ask, is there a way for the client to actively (after disconnection) reconnect the API?

If not, is there any other way to solve the problem I am currently facing?

zonyitoo commented 1 year ago

I really doubt that switching the underlying UDP socket could solve your problem. Maybe the KCP session detected congestion so the speed of transmission declines. You should open trace log and see what exactly happening in the KCP session.