[Libwebsockets] Rx issue

Andy Green andy at warmcat.com
Wed Nov 14 21:28:39 CET 2018



On November 15, 2018 2:05:28 AM GMT+08:00, Alessandro Longobardi <alessandro.longobardi.1992 at gmail.com> wrote:
>Hi, this is my first post. I'm Alessandro a Phd. student  of the Scuola
>Superiore Sant'Anna from Pisa (Italy).
> I have a problem on receiving packets:
>i have a process that sends large packets (i.e. 6-7 KB)  on a Node JS
>webserver, the same webserver sends back the packets (echo). Some
>packets
>received back are partially different from the same ones sent (i test
>with
>a checksum on the packet data).  I use libewebsocket v3.0-stable on the
>latest commit ( Nov 9, 2018), the packets are not fragmented (first and

The packets will be fragmented at tcp even if not at ws...

>final flags set to 1) and are binary data. Possible reasons?

... the question is both too open-ended, with no description of what happens, no code, and too constrained (there's no evidence mentioned this is an 'rx issue').

You need to dump what was sent and received and isolate the difference... it's corrupted, undersize, oversize... your code deals with the fact your atomic ws message may turn up in multiple RX pieces... that for echo, you may not have been able to tx a piece before the next rx piece came and overwrote a single buffer... necessitating a ringbuffer...

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-client/minimal-ws-client-echo/protocol_lws_minimal_client_echo.c
https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-server/minimal-ws-server-echo/protocol_lws_minimal_server_echo.c

-Andy

>
>Thanks,
>Alessandro


More information about the Libwebsockets mailing list