[Libwebsockets] Unable to send very large sized packets through websockets

Hemant Kumar hkumar at arubanetworks.com
Sun Nov 10 01:29:28 CET 2013


Hi

I have set the size of LWS_MAX_SOCKET_IO_BUF to 64K so that I can send large sized packets.
If I send 32 K packets, my callback handler is called twice as expected , but as I tend to approach
64K ,it is called every once for the packet send:
[1384042703:8452] NOTICE: 0 997 (0) :tx 60016 <===sending 60K sized pkts
[1384042703:8453] NOTICE: 1 998 (0) :tx 60016
[1384042703:8458] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
[1384042703:8458] NOTICE: 0 999 (0) :tx 60016
[1384042703:8464] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
[1384042703:8464] NOTICE: 0 1000 (0) :tx 60016
[1384042703:8470] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE

When I try sending 63K packet , it fails sending 9th packet with following error:

[1384042832:4989] NOTICE: 1 8 (0) :tx 63016
[1384042832:4991] ERR: Unable to spill ext 63008 vs 49152
[1384042832:4991] NOTICE: 2 9 (0) :tx -1


To get over this issue, I increased the LWS_MAX_SOCKET_IO_BUF to 128K.
In this case as I approach 110K, it fails as:

[1384043094:9284] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
[1384043094:9286] NOTICE: 0 43 (0) :tx 110028
[1384043094:9296] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
[1384043094:9299] NOTICE: 0 44 (0) :tx 110028
[1384043094:9300] ERR: Unable to spill ext 110014 vs 102978
[1384043094:9300] NOTICE: 1 45 (0) :tx -1
[1384043094:9300] INFO: libwebsocket_service_fd: closing
[1384043094:9301] NOTICE: LWS_CALLBACK_CLOSED


What is the maximum limit we can set on LWS_MAX_SOCKET_IO_BUF and what is the relation with the max size packet we can send? When I tried setting this to 1024K, I was not able to send a single packet.

Can you please clarify and suggest way for sending very large sized packet without application worrying about fragmentation ? Websocket as the RFC states is supposed to be message oriented protocol, so I believe there has to be a way not to care about frag issue associated with large sized packets?

Thanks
Hemant










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20131110/564e34ed/attachment.html>


More information about the Libwebsockets mailing list