How to design this problem - started multiple file uploads to server and then perform a task corresponding to each finished upload



  • Hi,

    I have this task at hand where in multiple file uploads can be started. Once a particular upload gets finished, I need to perform a particular task. I am using _QNetworkAccessManager _to upload files using PUT method and getting callbacks for finished uploads in finished(QNetworkReply* ) method.

    Can somebody help me design the solution to this problem? Basically i want to know how do I make sure that a particular upload has finished and finished callback corresponds to that particular upload and not any other upload as upload of a smaller file might get finished before a big file upload. How to generalize the solution to this problem?

    Any suggestions/hints appreciated.
    Thanks



  • Do you know the QtConcurrent framework ??
    http://qt-project.org/doc/qt-5.1/qtconcurrent/qtconcurrent-index.html

    What I will do is to create a method that manage the upload in a blocking way and return only when the upload of the file has been completed (or return an error).
    Then, I will use the QtConcurrent to run a pool of such methods in parallel that uploads different files.
    And then, I will use a QFutureWatcher to execute whatever you need when one upload has been completed.
    http://qt-project.org/doc/qt-5.1/qtcore/qfuturewatcher.html#resultReadyAt

    Cheers,
    Gianluca.



  • No I never used them.

    Would be great if you could provide me with some working example of this.

    Thanks


Log in to reply
 

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