Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QNetworkAccessManager - finished signal (when emitted)
RavensAngel last edited by RavensAngel
I have a REST-service which i access using an HTTP POST. Using soap ui, i get timings like 30 ms. When using QNetworkaccessmanager (connecting the finished signal, direct connection) i get 230 ms.
I used wireshark to check what is going on...
What i see is that both ways are sending the same messages:
- TCP SYN (time: 15.9528600)
- TCP SYN, ACK (time: 15.9536980)
- ACK (time: 15.9537440)
- HTTP POST (time: 15.9549770)
- HTTP REPLY (time: 15.9998710)
- TCP ACK (time: 16.1998570) --> the time difference between the last HTTP reply and the ack is +/- 200 ms...
The question is, is the finished signal emitted after the TCP ack in QNetworkAccessManager and can i force the signal to be emitted faster? Is it normal it waits to ack the reply before sending the finished signal? If so, is there another signal i can use to get the reply sooner?
Or am I doing it wrong?
Part of code:
_am = new QNetworkAccessManager(); connect( _am, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( _requestFinished( QNetworkReply* ) ), Qt::DirectConnection ); ... QNetworkRequest request( _requestData.url ); request.setHeader( QNetworkRequest::ContentTypeHeader,"application/json" ); _elapsed.restart(); _reply = _am->post( request, _requestData.data );
I time using QElapsedTimer just before doing the post and within the _requestFinished slot i take the elapsed time and output it.
I always see 200+ ms...
Any help? Or ideas?
Thanks in advance.