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

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



  • @mrjj
    service constructor:
    p = new QProcess(this);
    p->start("C:/Users/from1/Desktop/QT_Downloader.exe");

    QT_Downloader constructor:
    QString filename = "https://sourceforge.net/p/qtlmovie/code/ci/v1.2.16/tree/build/windows-build-qt-static.ps1?format=raw";
    QUrl url1 = QUrl::fromUserInput(filename);
    m_downloader = new SimpleDownloader(url1, QDir(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)), true, this);


  • Qt Champions 2016

    @Taz742
    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
    https://forum.qt.io/topic/5067/solved-qnetworkaccessmanager-downloads-won-t-start/9



  • @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

    Hi,

    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