Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkAccessManager causes network traffic spike every 5 seconds in wireless network

QNetworkAccessManager causes network traffic spike every 5 seconds in wireless network

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xuy_98
    wrote on last edited by
    #1

    Previously I asked a similar question on network traffic spike every 5 seconds in wireless network. At that time I thought it's caused by QWebKit. Later I created a small download program - actually I only instantiate QNetworkAccessManager and don't do anything with it. The program causes 'pinging' the router to take more than 100 ms every 5 seconds. When the program does not run, the pinging takes less than 1 ms.

    I used WireShack to check the packet and it seems the program tried to resolve some address. I don't why it does that and how to stop it.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should also add which version of Qt you are using and on what OS.

      Without a code sample on how you are using QNetworkAccessManager, it's impossible to help you search a solution

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xuy_98
        wrote on last edited by
        #3

        Thanks for your reply. I just tested on 64bit Windows 7 with Qt 5.3. Here is the code (same for earlier releases like 4.8):
        @
        int main(int argc, char *argv[])
        {
        QNetworkAccessManager manager;

        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        
        return a.exec();
        

        }
        @
        Here is pinging results with the program is running:
        @
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=74ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=29ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=1ms TTL=255
        Reply from 10.144.55.2: bytes=32 time=59ms TTL=255
        @
        When I stopped the program, the pinging result is always
        @
        Reply from 10.144.55.2: bytes=32 time<1ms TTL=255
        @
        I figure QNetworkAccessManager tries to contact the server to resolve address but I don't know how to stop it.

        BTW, I also tried dynamically created QNetworkAccessManager and deleted it after a few minutes. It proves QNetworkAccessManager caused the ping delay.

        Thanks.

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xuy_98
          wrote on last edited by
          #4

          BTW, Qt example: fancybrowser and browser have the same behavior.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            The first thing that strikes me is that you are creating the QNAM before the QApplication, which is wrong. QApplication must always be created first to allow proper library initialization.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xuy_98
              wrote on last edited by
              #6

              Thanks for helping. I switched the sequence of QNAM and QAPP. The results are the same.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andreyc
                wrote on last edited by
                #7

                You can try to use "Wireshark":http://www.wireshark.org/ to monitor the network activity.

                [EDIT] I don't see any abnormal network activity when the example app is running. But there is no wireless interface on my computer.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xuy_98
                  wrote on last edited by
                  #8

                  The issue appears in wireless environment only. Thanks for your comments.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved