1

I'd like to log the lifetime of a QNetworkReply object. This includes:

  1. When the underlying socket connection is established
  2. When the first byte of the request is sent
  3. When the first byte of the response received
  4. When the last byte of the response finished

(3) and (4) can be determined by listening for the downloadProgress signal, but I'm not sure how to do (1) and (2). Is there a way to listen on the underlying socket of a QNetworkReply? The uploadprogress signal doesn't seem to be triggered for GET requests.

marketer
  • 41,507
  • 11
  • 37
  • 40

2 Answers2

1

I have no idea if (1) is possible but the others are easy. Have you seen my network trace example? Does it not work for your case?

Ariya Hidayat
  • 12,523
  • 3
  • 46
  • 39
  • +1 Nice code. However I don't see how it gives answer to the second question - *When the first byte of the request is sent?* – Piotr Dobrogost Feb 27 '11 at 11:20
  • I believe that's fairly low level. It depends on how many HTTP connections are still available, caching, pipelining, etc... – Ariya Hidayat Mar 14 '11 at 06:02
0

As far as I know Qt does not expose mechanism used by QNetworkAccessManager to get data so I think you can't accomplish neither the first nor the second task from your list.
Please remember that QNetworkAccessManager handles not only http(s): schemes but also local ones like file: and qrc: which do not require any socket connection.

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366