Giter Club home page Giter Club logo

Comments (6)

xtaci avatar xtaci commented on July 18, 2024

You can encode like this: |size|payload| , try to add a size prefix before the payload.

from kcp-go.

89trillion-wuyanqing avatar 89trillion-wuyanqing commented on July 18, 2024

I don't quite understand what you mean, can you tell in which method this parameter should be set.

from kcp-go.

xtaci avatar xtaci commented on July 18, 2024

why not just add a prefix before the data, the prefix suggests how many bytes are there in the packet.
|size|payload|size|payload|.... |size|payload|

from kcp-go.

89trillion-wuyanqing avatar 89trillion-wuyanqing commented on July 18, 2024

Do you mean that before calling the Write method, I split the binary data myself, and each split data packet needs to add a 2-byte prefix to indicate the size of the data packet?
Snipaste_2024-05-20_22-01-23

In fact, my core question is whether the work of splitting data packets is implemented in the third-party package or by the user himself?

from kcp-go.

xtaci avatar xtaci commented on July 18, 2024

users should be in charge of managing the border of packets. In general, kcp-go provides a realiable stream only.

from kcp-go.

89trillion-wuyanqing avatar 89trillion-wuyanqing commented on July 18, 2024

When I looked at the code, I found that you would split the large data packets into segments, so I thought that the third-party package had already encapsulated the data splitting work.
Snipaste_2024-05-21_21-56-49

Because after I modified this code, when sending a large data packet, the simulated client can normally receive a complete assembled data packet, so I think that this data splitting work needs to be encapsulated, and the user is not responsible for managing the boundaries of the data packet.
Snipaste_2024-03-29_23-27-53

So if I make the above changes, will there be any serious consequences?

from kcp-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.