c++ - Qt QNetworkAccessManager long delay to emit finished signal -



c++ - Qt QNetworkAccessManager long delay to emit finished signal -

i utilize qnam handle uploads using ftp protocol. whole process works have unusual behavior:

this method :

void ftp::uploadfile(const qstring &origin, const qstring &destination) { qurl url("ftp://"+host+""+destination); url.setusername(user); url.setpassword(pwd); url.setport(21); localfile = new qfile(origin, this); if (localfile->open(qiodevice::readonly)) { reply = nam->put(qnetworkrequest(url), localfile); qobject::connect(reply, signal(uploadprogress(qint64, qint64)), slot(transferprogress(qint64, qint64))); qobject::connect(reply, signal(finished()), this, slot(transferfinished())); } else qdebug() << localfile->errorstring(); }

when upload file, uploadprogress emitted :

qdebug() << sent << "/" << total;

outputs 0/x till x/x . takes long time, maybe up 20 seconds before finished signal emitted. why delay?

i tried ignoring finished signal , emit signal myself when progress @ sent==total file corrupted @ other end. (it's not corrupted, send jpg, resulting file upper-half jpg. big part grey.)

i'd provide users progress bar 100% means process finished. uploading 5 seconds, staying 20 seconds @ 100% isn't nice.

file upload buffering in background (qt socket buffers, scheme socket buffers, network buffers) 'progress' signal means send info somewhere nor server has received it. while 'finished' signal emitted when info transferred remote side , buffers flushed. if need know exact size transferred may disabling request or socket(s) or qnam buffring/caching.

c++ qt qt5 qnetworkaccessmanager qnetworkreply

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -