As a proof-of-concept the web server has to do is follow these steps:
- Listen on a TCP port
- Whenever a client tries to open a connection, (and there is a task able to serve it), accept it
- Parse the text sent by the client, HTTP request
- Process said request
- Reply a textual answer, HTTP response
I have to handle a maximal of six requests, therefore I have six equal (static-) tasks waiting for a connection. They share the same code, but each task has its private context (local variables).
These tasks, plus an additional couple of tasks for the TCP/IP networking, are scheduled by ucOS/2.
What is wrong with this scheme? It's simple, it does its job, and the code is neat, and doesn't require to significantly refactor your code