How To Download File With QT Service

  • Hi all..
    I wrote service, when this service is running in every 15 seconds it calls one exe file from desktop and one file must be downloaded with this exe file but it doesn't download anything

  • Qt Champions 2016

    Can you please show code and details on what you are doing.

  • @mrjj
    service constructor:
    p = new QProcess(this);

    QT_Downloader constructor:
    QString filename = "";
    QUrl url1 = QUrl::fromUserInput(filename);
    m_downloader = new SimpleDownloader(url1, QDir(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)), true, this);

  • Qt Champions 2016

    Did you hook up the QProcess error signals so u can see if something is up ?

    also for the SimpleDownloader. Its important to see if any errors is reported.

    Also if you run this manually in a shell/cmd.exe

    Does it then work ?

    ps what is SimpleDownloader `?
    This class

  • @mrjj
    yes, it works but when downloader.exe is called from service, it doesn't download anything

  • because I think that this service doesn't have network access

  • Lifetime Qt Champion


    Your code doesn't do any error handling so like @mrjj suggested: connect all error related signals to see what is happening and add proper checks.

Log in to reply