J
J
JkLKot2020-10-27 21:31:43
Computer networks
JkLKot, 2020-10-27 21:31:43

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

3 answer(s)
A
Armenian Radio, 2020-10-27
@gbg

Depends on the problem being solved. Somewhere Json is good, somewhere a binary format, somewhere compressed json

V
Valentin, 2020-10-27
@vvpoloskin

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.

D
DDwrt100, 2020-10-28
@DDwrt100

It seems to me or you are mixing the OSI levels a bit. udp 4 and json 7 ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question