Close

A much better timing system

A project log for micro HTTP server in C

Connect your browser to your smart devices, using a minimalist HTTP compliant server written in POSIX/C

yann-guidon-ygdesYann Guidon / YGDES 04/24/2020 at 05:380 Comments

The project has hit a wall when I found that more than one socket needed to be read, because browsers tend to get webpages from multiple connections.

TL;DR : I have re-designed the system around poll() and the timeouts and other peripheral details are now handled in a wrapper function.

The latest archive doesn't contain a working system but the foundations seem to work well. I still need to modify the server but the surrounding code is pretty good now, and the conversion will be easy.

The new code exposes a number of global variables and functions :

Overall it looks like collaborative multitasking, with timeout management sprinkled all over the code.

The constraint is that each slice of work must be reasonably short (100ms ?) to keep the system responsive.

Behind the scene, it's not trivial but it seems to work well. The functions are rather well layered and the timeouts seem to do their work.

I have so far provided a "dumb" application that reads orders from the command line and wastes time writing to the screen, it will soon include the real socket server instead.

The cool part is that the host program has very few constraints and it should work nicely with GHDL !

Discussions