Search code examples
cudpevent-driven-design

Passing http form values to a C program


I've been assigned to upgrade an embedded application written in C. The application is configured via a web interface.

When the user modifies the web application a file is written to /var/www/settings.json and the file /var/www/UPDATE_SETTINGS is touched.

In the main application loop it checks to see if UPDATE_SETTINGS exists. If it does it parses the settings.json with json-c and then deletes UPDATE_SETTINGS.

This works well enough, however, we would prefer to move to an event-driven architecture (perhaps libev) in which settings.json is fed directly into the program by the webapp script to a plain-old UDP port and then issue a callback to perform the update.

What are some other elegant ways to solve this problem? Should we just stick with the current approach?


Solution

  • Just use inotify. It was created for cases like yours.