So, about my task is this:

The HTTP server creates a connection to some address, such as localhost:4567 , at which the directory selected by the user is available.

For example: In the test/ directory are the files index.html , contact.html , menu.html . I create a connection and at localhost:4567/index.html , I have a page from the test/ directory, if I go to localhost:4567/menu.html , the menu.html from the test/ directory opens, and so on. At the same time, I want to periodically refresh the page from my main Qt application (that is, not to press F5 in the browser, but for my program / server to refresh the page itself).

In short , the server needs only 2 functions: to make the contents of a directory accessible to the browser at localhost:4567 and to be able to update the page from my Qt program.

Need to write your own HTTP server or are there ready solutions? In which direction to dig, please tell me.

    2 answers 2

    https://github.com/nitroshare/qhttpengine

    This library is able to do, then it is described in the first part. Specify the directory and through the web server have access to these files.

    Regarding the update from the qt of the application, I see the following scheme: a web page with a certain interval through ajax sends a request to the API, which can also be implemented using the above library, and the server responds: whether the page needs to be updated or not.

    Take the usual Apache and customize it as you like.

    Key points are directory indexing and virtual hosts. On virtual hosts, you can make the contents of a specific folder open on each individual port.

    • This is nice, but my application will run not only on my computer, where I can configure Apache, but also on computers where it is not installed at all. - Nik