wolfMQTT
wolfMQTT copied to clipboard
replace select() with a call able to handle >1024 filedescriptors
In this line: https://github.com/wolfSSL/wolfMQTT/blob/0ba0929bfc0fbaffd5a612ed9c79eefcd0aea134/examples/mqttnet.c#L672 a posix select() call is used.
This is limited to handle a maxmium of 1024 filedescriptors in a system (overall, not only in that specific call!).
Depending on the system, this is not limited to sockets, but simple files as well.
If the select() is then called wth an fd where the id is above 1024, the behavior is undefined, in most cases it just fails.
==> please replace this by e.g. poll() or other more modern mechanism for the scheme
Hello @tabascoeye
Thanks for your suggestion! I will treat this as a feature request. The example client code is designed to be easy to understand and helpful for someone getting started. I think this feature will support those goals.
Could you tell us a bit about your project? Does the 1024 fd limit from select() impact you?
Hi @tabascoeye ,
Thank you for the suggestion.
@embhorn , we have some examples for using poll vs select here: https://github.com/wolfSSL/wolfsentry/blob/naii_demo/examples/notification-demo/echo_server/echo.c#L530 https://github.com/wolfSSL/wolfsentry/blob/naii_demo/examples/notification-demo/echo_server/echo.c#L647
If you do add this support please make sure there is a build option to support either.
Thanks, David Garske, wolfSSL