Nominate our 2022 Qt Champions!

To QtService or not to QtService?



  • Hello,

    I need to implement a program that will run on both Windows and Linux machines, and that acts as some kind server or service/daemon: the program will listen for incoming XML messages, will process these messages and perform certain actions depending on what XML message it received, and will send XML responses.

    Now I came across the QtService class at https://github.com/qtproject/qt-solutions/tree/master/qtservice and I am wondering what to do, with my options probably being:

    1. Write the program without using QtService.
    2. Use QtService and make it a real service (on Windows) or daemon (on Linux).

    However, it is not completely clear to me why I should us QtService (or why not...)
    What extra benefits does it give me if I decide to write the program using the QtService? What are the typical use-cases? Are there any disadvantages for using it too?

    And also, from the documentation for the 2.0 version at https://github.com/qtproject/qt-solutions/blob/master/qtservice/README.TXT I read "Reimplemented for Qt 4 with improved API."
    Our codebase already uses Qt 5.15.1. Is QtService working with Qt 5.15.X?



  • Did you ever make a decision on this?

    There is also https://github.com/Skycoder42/QtService, which Skycoder42 does not disagree is dead, and which also has questionable support for Qt6.

    I am just now at the point of deciding to use an existing lib to do this, or to just implement a simple Windows over version for now that meets my immediate needs.



  • What extra benefits does it give me if I decide to write the program using the QtService? What are the typical use-cases? Are there any disadvantages for using it too?

    It saves you the time of writing code to install or uninstall a Windows service and interface with that control system.
    On UNIX-like systems you get a socket-based control interface that provides similar capability.

    Our codebase already uses Qt 5.15.1. Is QtService working with Qt 5.15.X?

    Probably, the Qt Solutions Library version has had some Qt5 compatibility work done to it. Should take all of 10 minutes to do the experiment.

    @paulpv The SkyCoder42 QtService does not seem to be a branch of the Qt Solutions version. It seems more capable in some areas but does cover others, most notably Windows service installation.
    The code clearly has comments related to Qt 6 compatibility so YMMV.

    Really depends on your specific requirement and what environments you need to support.


Log in to reply