Answer the question
In order to leave comments, you need to log in
How to assemble a datagram correctly?
How to correctly collect information in a datagram? I know that this is individual, but the best option at the moment, taking into account the transmission over udp? Now I use Json for tests, but I don’t think it’s right
Answer the question
In order to leave comments, you need to log in
Depends on the problem being solved. Somewhere Json is good, somewhere a binary format, somewhere compressed json
A datagram is a collection of bytes. What you encode in it is up to you. But as if in order for json to become a set of bytes and be recognized, it is also necessary to determine the encoding, and in order for it to be read correctly, it is necessary to ensure that the order of the packets is preserved and that a large portion of data is correctly broken down into packets. And as a rule, fast processing is expected from UDP, and loading the contents of the datagram with json (which, by the way, under certain conditions can be parsed for a long time), makes no sense.
The easiest way is to encode values in bytes and bits.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question