Check qws server



  • My embedded application need to know if there is a running qws server .

    My application can be started one or two times at the same time.

    The application must be started for the first time with -qws parameter while the second time without -qws:
    @
    ./app -qws &
    (first application started)
    ./app &
    (second application started)
    @

    I'd like to always start application without -qws, check in the main() if -qws is required and then restart application with right parameter.

    For example:
    @
    int main(int argc, char *argv[])
    {
    ...
    ...
    if(qwsRequired())
    {
    QProcess::startDetached(QApplication::applicationFilePath(), parameter_list);
    exit(12);
    }
    ...
    }
    @
    I need qwsRequired() .



  • I dont know of any api which tells you whether qws is running or not, but may be in script you can find with ps and then use that. i know this may not be the answer you wold be looking for but this what comes to my mind



  • Or you can use some kind of "lock" file mechanism (similar to the daemons running on linux, storing their pid in a file, which can be checked if it does exist or not)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.