Split FreeRTOS_TCP_server socket work functions in indipendently tasks

claudiorossi wrote on Thursday, October 18, 2018:

Hi all

I’m using the FreeRTOS_TCP_server to manage three different sockets (CLI, FTP and user) and all
work fine.
Now I have see that all work functions are called in a while loop (in FreeRTOS_TCPServerWork) so if a socket work function run slowly or is blocked, all my TCP server is affected.
I would like to manage the work function of any socket in a separated task so any socket can run indipendently.
Is it possible to do this? If yes, what I need to modify? Can I use a semaphore to trigger the work task?

Regards

heinbali01 wrote on Friday, October 19, 2018:

The TCP server module, with FTP and HTTP, is more like a demo project. It shows how you can handle many sockets without creating many tasks, by using FreeRTOS_select().

In a real application, I can imagine that it can be worth to use more tasks with different priorities.

if a socket work function run slowly or is blocked,
all my TCP server is affected.

It is not OK to have a working function block: all sockets should be used in a non-blocking way. If you can not write to a socket, activate the eSELECT_WRITE bit for that socket, and the work function will be called again as soon as data can be sent.

claudiorossi wrote on Wednesday, October 24, 2018:

Thank you
Initially I will use the TCP server module to manage the FTP server only and I will write different tasks for the other servers. Then I will try to modify the FTP server too.