Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 buffer as byte[1024 * 4] from websocket message, reason behind?

views
     
TSragk
post Jun 2 2022, 03:30 PM, updated 4y ago

BooBoo~
*******
Senior Member
2,354 posts

Joined: Apr 2009


Attached Image
I'm researching on raw websocket implementation recently, from multiple example I found they are all buffering the message with the same size byte [1024 * 4], is anyone know the reason behind this? Is this a recommended standard size? And is that any circumstance where I should reduce or increase this size?

This post has been edited by ragk: Jun 2 2022, 03:57 PM
TSragk
post Jun 2 2022, 05:58 PM

BooBoo~
*******
Senior Member
2,354 posts

Joined: Apr 2009


QUOTE(15cm @ Jun 2 2022, 05:36 PM)
did you mean 1024 or 4 ?

1024 is a meaningful number in software engineering because its 4x256 and 2x512

256 is 2 to the power of 8.

2 because computer uses a a base 2 calculation method (1 and 0 ) and 8 because 1 byte is made up of 8 bits
*
Both, it end up with buffer size of 4096, just want to have more understanding about it, is this a buffer figure that I should adjust according to my scenario (let say that's some, which I dunnoe what yet) or this should always be a standard figure?
This sound like the max received message size it would accept through the socket? I'm not very familiar with low level design, should this be something configurable? Or the figure could be higher and it won't break any low level message transmission.
TSragk
post Jun 7 2022, 10:35 AM

BooBoo~
*******
Senior Member
2,354 posts

Joined: Apr 2009


Thanks for clarify guy!

 

Change to:
| Lo-Fi Version
0.0201sec    1.02    7 queries    GZIP Disabled
Time is now: 23rd December 2025 - 11:30 PM