Since FD numbers are shared among threads in LwIP (everything is basically one process),
This is an important difference between LwIP on an RTOS and Linux. In Linux each process’ FDs will start at 0 and the application won’t have to worry about not fitting within fd_set unless the use case is for a large number of sockets, in which case the can detect/handle the issue.
In an RTOS, where you have multiple networking applications (which would typically be their own processes on Linux) but each are simply threads in the same process space, now a thread’s first call to socket() could return an FD larger than what FD_SETSIZE can hold rather than 0. This would require modifying all applications to expect FDs that couldn’t fit within fd_set even when they are only using a small number of sockets
Joel |