[Libwebsockets] How to set a max number of clients

Andy Green andy at warmcat.com
Wed Oct 29 20:15:23 CET 2014



On 29 October 2014 23:55:13 GMT+08:00, Tiago Costa <tiago.rocha.alves.costa at gmail.com> wrote:
>Hi,
>
>I have a simple server, and I am currently attempting to limit the
>number
>of clients.
>I found mention of a "MAX_CLIENTS" setting in the LWS_CALLBACK_HTTP
>reason
>description, but nowhere else.

This used to be a hard limit, but a much more flexible fd mapping scheme was contributed meaning we could get rid of it.

>Is it possible to set a maximum number of clients? If yes, how can I do
>this?

You can do what you want using the callbacks, depending on what you mean by 'client'.

Count connections in WSI_CREATE and WSI_DESTROY callbacks.

If you think there are too many connections, hang up on him at LWS_CALLBACK_FILTER_NETWORK_CONNECTION

-Andy

>
>Regards,
>
>Tiago
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list