[Libwebsockets] bidirectional binary data transfer with binary websockets
andy.green at linaro.org
Sat Dec 28 02:50:21 CET 2013
On 28 December 2013 03:48, Hemant Kumar <hkumar at arubanetworks.com> wrote:
> You can definitely increase the size of data you can write in using
> libwebsocket_write() but there is a limit to it and I believe right now,
> this is the method to send data. We cannot send large file without slicing
> it in small chunks.
> To increase the size of these chunk, you can increase the size defined under
> LWS_MAX_SOCKET_IO_BUF. Also, you can vary the size of messages going to be
> exchanged in your sub-protocol definition.
> There is a libwebsocket thread "[Libwebsockets] [libwebsockets] #45: What's
> the best way to send huge images/video files from client to server? ". You
> can follow that to find this out.
Yeah that's right. Because lws works in nonblocking mode, there's a
(dynamically decided) limit to to the size of write the kernel will
accept at the raw socket. The rest of lws arrangements are all about
dealing with that immutable fact.
You can see how to send large files with http in the test server app
when it sends leaf.jpg.
If you're sending it in websocket mode, either the message
fragmentation stuff or managing sending it in pieces is not that
> From: Andy Green [extracats at googlemail.com] on behalf of Thomas Spitz
> [andy.green at linaro.org]
> Sent: Friday, December 27, 2013 9:41 AM
> Cc: libwebsockets at ml.libwebsockets.org
> Subject: Re: [Libwebsockets] bidirectional binary data transfer with binary
> In fact, my question is whether we can send big files with
> libwebsocket_write() without having to slice the file in small chunk of less
> than a given size (2001 bytes in test-fraggle)
> On 27 Dec 2013 18:22, "Hemant Kumar" <andy.green at linaro.org> wrote:
>> There is LWS_BINARY ,you can use in libwebsocket_write() for binary data.
>> Gurus of LWS can clarify further ,if there is something more to it.
>> > On Dec 27, 2013, at 9:13 AM, "Thomas Spitz" <andy.green at linaro.org>
>> > wrote:
>> > Hello everybody,
>> > Is there a simple way to send and receive binary data using lws? As for
>> > example, sending/receiving a 1Mb binary configuration file, an image, ...
>> > I've seen through test-fraggle example that it is possible to send big
>> > file slicing it manually. I also saw that libwebsocket_write() returns the
>> > number of byte effectively written and it is said that the user has to send
>> > the rest of the message if it hasn't been completely sent. It seems that raw
>> > functions are there but Am I missing any advance function like extensions?
>> > Thanks in advance,
>> > Thomas
>> > _______________________________________________
>> > Libwebsockets mailing list
>> > Libwebsockets at ml.libwebsockets.org
>> > http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets