Results 1 to 8 of 8

Thread: Network statistics with QNetworkAccessManager

  1. #1
    Join Date
    Mar 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Network statistics with QNetworkAccessManager

    Hey,

    is there a way to obtain the total number of bytes sent/received from a QNetworkAccessManager object? Or do I need to keep track of all requests/replies to do that? But even then I'm missing all the overhead and only get the size of the plain data sent/received, am I not?
    Any ideas how to do that? Thanks.

    Cheers,
    fallen

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Network statistics with QNetworkAccessManager

    The class doesn't hold any statistics. Even if you track all the requests and replies manually, you won't get the total size transmitted/received, at least not for ssl connections (you won't have access to the encrypted stream). If you need such data, implement your own network proxy and setup the network access manager to forward all connections though it. Then you'll be able to track each byte that flows through it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Network statistics with QNetworkAccessManager

    Quote Originally Posted by wysota View Post
    The class doesn't hold any statistics. Even if you track all the requests and replies manually, you won't get the total size transmitted/received, at least not for ssl connections (you won't have access to the encrypted stream). If you need such data, implement your own network proxy and setup the network access manager to forward all connections though it. Then you'll be able to track each byte that flows through it.
    Thanks, but after digging through the documentation available for the proxy classes and their sources, I can't really figure out how to use them in order to count the bytes flowing through. I can't even find any methods that allow any bytes to flow through... Any further help would be very appreciated.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Network statistics with QNetworkAccessManager

    You are not supposed to use any proxy classes. You are to implement a network proxy (i.e. a SOCKS5 proxy).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Network statistics with QNetworkAccessManager

    Yes, sure, but how?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Network statistics with QNetworkAccessManager

    Quote Originally Posted by The_Fallen View Post
    Yes, sure, but how?
    Khem... First write the code, then compile it and then test it

    And seriously it would be a good idea to read a bit about how network proxies work
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Network statistics with QNetworkAccessManager

    Phantastic answer... What do you think, why I'm asking? Can't find anything more specific about network proxies in Qt. Or are you seriously suggesting to write a stand-alone proxy server to handle this task and then connect to it from my Qt app? Great idea...

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Network statistics with QNetworkAccessManager

    Quote Originally Posted by The_Fallen View Post
    Can't find anything more specific about network proxies in Qt.
    Who said anything about Qt? I said you should implement the proxy, not use it so why are you searching in Qt for it? It's not there.

    It's really not that compilcated to enter "SOCKS5" (or SOCKS4 or simply SOCKS) in your favourite web search engine and see what pops up.

    Or are you seriously suggesting to write a stand-alone proxy server to handle this task and then connect to it from my Qt app?
    No, not a stand alone server. Just a little class which will receive connections from the network access manager, serve as a socket server for it and do the bookkeeping in-between.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. get network stream with QNetworkAccessManager
    By Remco in forum Qt Programming
    Replies: 0
    Last Post: 26th August 2010, 16:25
  2. Replies: 0
    Last Post: 7th August 2010, 09:55
  3. Log statistics program
    By codemonkey in forum Qt-based Software
    Replies: 4
    Last Post: 28th November 2009, 08:40
  4. QNetworkAccessManager or QHttp
    By mind_freak in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2009, 20:24
  5. Replies: 5
    Last Post: 20th January 2006, 21:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.