-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data splitting and merging #260
Comments
You can encode like this: |
I don't quite understand what you mean, can you tell in which method this parameter should be set. |
why not just add a prefix before the data, the prefix suggests how many bytes are there in the packet. |
users should be in charge of managing the border of packets. In general, kcp-go provides a realiable stream only. |
I encountered the same problem as you, and my solution is the same as yours, which is to modify the WriteBuffers() method so that it does not split packets before calling kcp.Send(). |
I have implemented the server and client using the kcp-go framework. The server sent a data packet larger than 1500 bytes. I expected the server to split this packet, and then the client would merge it upon return. However, the result was that the server split the packet into multiple packets, and the client ended up receiving the fragmented packets, rendering them unusable.
In your WriteBuffers method, you first split the sent data according to the maximum transmission unit parameter (mss) and pass the segmented byte data to the Send method. Then, in the Send method, the logic of splitting the data into fragments is applied. As a result, the data packet will never exceed the maximum transmission unit, and therefore, the logic of splitting and merging will never be triggered.
I believe there needs to be a modification in the framework. At the user level, after sending a data packet, the receiving end should receive a complete packet instead of it being split into multiple fragments.
Therefore, I suggest that the WriteBuffers method does not need to split the sent data according to the maximum transmission unit parameter (mss). Instead, the original data should be passed directly to the Send method.
I'm not a native English speaker, so my expression may not be very accurate. Please understand.
The text was updated successfully, but these errors were encountered: