andy at warmcat.com
Tue Mar 17 18:22:31 CET 2020
On Tue, Mar 17, 2020 at 09:41, Pranjali Chumbhale <pranjalic at safeai.ai>
> Hello Team,
> I am a bit confused with the pointer to pass to lws_write call.
> On websocket data goes like: LWS_SEND_BUFFER_PRE_PADDING + DATA +
For many years you just need to add LWS_PRE size before the buffer.
You don't need any POST padding just LWS_PRE before. It's used by the
protocol to prepend protocol framing data without having to copy the
> So should the buf point to start of pre-padding and len should be
> inclusive of pre paddinga nd post padding? Or just the length of the
You should point to LWS_PRE bytes past the start of the buffer and give
the length as the length of the actual data.
So if you want to send "HELLO" then in memory
[ LWS_PRE BYTES UNINITIALIZED ][ HELLO ]
actual buffer start -> [ LWS_PRE BYTES UNINITIALIZED ] pointer given
to lws_write ---> [ HELLO ]
and the length to lws_write is 5.
> LWS_VISIBLE LWS_EXTERN int
> lws_write(struct lws *wsi, unsigned char *buf, size_t len,
> enum lws_write_protocol protocol);
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets