Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QProcess VS Qt-Solutions for daemon-service app
Hi, i looked through some resources and examples but it is still unclear for me if i have to use QProcess or Qt-Solutions in case i want to build daemon/service app ( for Linux/Windows respectively ). Could anybody clearify this please?
Thank you in advance
I don't see how
QProcesswould help you to build a daemon, you could use QtService or if you want to try it out QtDaemon (by myself and SGaist). The latter has a branch to be merged but I have been far too busy to do it.
ainu last edited by ainu
@kshegunov thank you for yout help)
jeremy_k last edited by
QProcess::startDetached allows you to start a program as a detached process that can outlive the parent process. It doesn't do anything to help create that program.
I'm presuming you're referring to the Qt Solutions service component, which provides facilities for creating and managing the execution of a service.
@jeremy_k thank you for your answer. This QProcess ability of detaching processes made me believe ( and seems falsely ) that i can create a daemon/service with it. But what did you mean by the phrase "it doesn't do anything to help create that program?"
and i still have question about this phrase from qt man "Unix: The started process will run in its own session and act like a daemon." Does this phrase mean that the new detached process is a daemon on Unix systems but it can't act as a service on Windows? and so i'd better put my eyes on Qt Solutons service component?
Thank you for your help
Does this phrase mean that the new detached process is a daemon on Unix systems but it can't act as a service on Windows?
Not exactly no. On *nix systems one needs to detach from the terminal when making a daemon (which is what I do in the QtDaemon module) on windows there's a specific API for services that works differently. That's why it's best you choose one of the proposed 2 solutions.
@kshegunov I see, now i understand. Thank you for your help and for your patience.