October 31, 2011

A.A.M. A.A.M.
Lab Rat
32 posts

QNetworkAccessManager in/out data counter

 

Hi all!
Is there any way to count in/out data size (up to a byte) which was transmitted trough QNetworkAccessManager?
Without using 3rd-party proxy server or something similar.
Thanks.

5 replies

October 31, 2011

ZapB ZapB
Robot Herder
1354 posts

You could do this using a QNAM proxy possibly coupled with a custom QNetworkReply. Take a look at this blog entry [blogs.kde.org] and the next couple by Rich Moore to get an idea of how you can customise QNAM and friends.

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

October 31, 2011

peppe peppe
Ant Farmer
1025 posts

The problem is that you have little or no control about how many bytes are actually transmitted “on the wire”, considering f.i. gzip compression, chunked encoding, encryption, proxies, etc.

If you’re willing to patch Qt of course you have complete control on the underlying sockets, so you can get some counters from them.

 Signature 

Software Engineer
KDAB (UK) Ltd., a KDAB Group company

October 31, 2011

A.A.M. A.A.M.
Lab Rat
32 posts

ZapB, thanks, interesting blog. I’ll try to apply a method described there.

peppe, unfortunately a patching Qt isn’t allowed. But that is a really powerful solution :)

October 31, 2011

ZapB ZapB
Robot Herder
1354 posts

You could also try using process accounting built into the OS. It depends exactly what you want to do.

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

October 31, 2011

A.A.M. A.A.M.
Lab Rat
32 posts

Just have QNetworkAccessManager and a couple of get/post requests. And want to have some connection info – count of rx/tx data.

 
  ‹‹ /usr/lib/x86_64-linux-gnu/libSM.so.6: undefined reference to `uuid_unparse_lower@UUID_1.0’      [SOLVED]QGraphicsView’s dragMode ››

You must log in to post a reply. Not a member yet? Register here!