#binary protocol?

18 messages · Page 1 of 1 (latest)

low tartanBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

clever egret
#

How does it work?
instead of sending a string and its length, you send a struct and its length

lost panther
clever egret
#

text is less memory efficient

#

eg INT_MAX fits into 4 bytes the same value as text takes 2147483647 10 bytes

#

which can get worse for bigger numbers

lost panther
#

I dont understand that, can you elaborate abit more in more simplified way

#

How is text less memory efficient

#

Wait so what is more efficient in general then? Binary or text?

#

Also could you show an example of how to send as binary? I heard if you send a struct you have to be careful depending on the endian type?

tidal quail
tidal quail
tidal quail
#

transforming your structs into text will always be less efficient, sending raw data is obviously better

clever egret
# lost panther How is text less memory efficient

to represent a single digit in ASCII you need at least 7 bits
if you were to use those 7bits to represent a number you could have one in the range of 0-127 that means you can fit two more digits into the same memory space

#

ASCII 0-9 1 digit, 7bits
binary 0-127 1-3digits, also 7 bits

low tartanBOT
#

@lost panther

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

lost panther
#

!solved