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. QTcpSocket waitForBytesWritten() is longer in Windows than Linux
Forum Updated to NodeBB v4.3 + New Features

QTcpSocket waitForBytesWritten() is longer in Windows than Linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 1.7k 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.
  • A Offline
    A Offline
    Ayse
    wrote on last edited by
    #1

    I'am sending packets (1 packet : 1344*8 + 4 bytes) over QTcpSocket. In Windows 10.000 packets wait ~1,500 second. It takes too much time when it is compared to Linux. I wonder what caused this.

    Regards ..

    jsulmJ 1 Reply Last reply
    0
    • A Ayse

      I'am sending packets (1 packet : 1344*8 + 4 bytes) over QTcpSocket. In Windows 10.000 packets wait ~1,500 second. It takes too much time when it is compared to Linux. I wonder what caused this.

      Regards ..

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Ayse How fast is it on Linux? Is it same machine with same network interface? You should provide more information for such comparisons.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Ayse How fast is it on Linux? Is it same machine with same network interface? You should provide more information for such comparisons.

        A Offline
        A Offline
        Ayse
        wrote on last edited by
        #3

        @jsulm Windows is Host machine and Linux is Guest on VmWare.

        jsulmJ 1 Reply Last reply
        0
        • A Ayse

          @jsulm Windows is Host machine and Linux is Guest on VmWare.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Ayse And how fast is Linux when it sends/receives packets?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Ayse And how fast is Linux when it sends/receives packets?

            A Offline
            A Offline
            Ayse
            wrote on last edited by Ayse
            #5

            @jsulm

            0_1534329156800_Windows.JPG

            Figure 1. Windows

            0_1534329175806_Linux.JPG

            Figure 2. Linux

            JonBJ 1 Reply Last reply
            0
            • A Ayse

              @jsulm

              0_1534329156800_Windows.JPG

              Figure 1. Windows

              0_1534329175806_Linux.JPG

              Figure 2. Linux

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #6

              @Ayse
              Who knows? Maybe Windows packet size or a million other possibilities.

              I think you're going to need to temporarily knock this out using C socket() routines and see whether it isn't same behaviour, to eliminate QTcpSocket being the difference.

              1 Reply Last reply
              1
              • K Offline
                K Offline
                kuzulis
                Qt Champions 2020
                wrote on last edited by kuzulis
                #7

                It is Windows "feature". We too faced with this, do not worry. :) Just do not use the waitForXX methods at all.

                My assumption is that a Linux "lies", it reports that a data transferred, but to where are transferred? To the other side? To the driver's buffer? And so on. :)

                Most likelly, that a Windows reports this time is to more true than a Linux.

                You can't relly on waitForBytesWritten and on this time, as all this is a hardware-drivers-specific, IMHO.

                PS: You can try to calculate an overage transferring time and to compare it to your Eth bandwidth (is it ~1000Mbit? ~100Mbit? ~10Mbit? ...).

                A JonBJ 3 Replies Last reply
                2
                • K kuzulis

                  It is Windows "feature". We too faced with this, do not worry. :) Just do not use the waitForXX methods at all.

                  My assumption is that a Linux "lies", it reports that a data transferred, but to where are transferred? To the other side? To the driver's buffer? And so on. :)

                  Most likelly, that a Windows reports this time is to more true than a Linux.

                  You can't relly on waitForBytesWritten and on this time, as all this is a hardware-drivers-specific, IMHO.

                  PS: You can try to calculate an overage transferring time and to compare it to your Eth bandwidth (is it ~1000Mbit? ~100Mbit? ~10Mbit? ...).

                  A Offline
                  A Offline
                  Ayse
                  wrote on last edited by
                  #8

                  @kuzulis I really wonder what kind of feature caused this.

                  Regards..

                  JonBJ 1 Reply Last reply
                  0
                  • A Ayse

                    @kuzulis I really wonder what kind of feature caused this.

                    Regards..

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #9

                    @Ayse
                    Try Googling windows sockets slow ?

                    1 Reply Last reply
                    0
                    • K kuzulis

                      It is Windows "feature". We too faced with this, do not worry. :) Just do not use the waitForXX methods at all.

                      My assumption is that a Linux "lies", it reports that a data transferred, but to where are transferred? To the other side? To the driver's buffer? And so on. :)

                      Most likelly, that a Windows reports this time is to more true than a Linux.

                      You can't relly on waitForBytesWritten and on this time, as all this is a hardware-drivers-specific, IMHO.

                      PS: You can try to calculate an overage transferring time and to compare it to your Eth bandwidth (is it ~1000Mbit? ~100Mbit? ~10Mbit? ...).

                      A Offline
                      A Offline
                      Ayse
                      wrote on last edited by
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • K kuzulis

                        It is Windows "feature". We too faced with this, do not worry. :) Just do not use the waitForXX methods at all.

                        My assumption is that a Linux "lies", it reports that a data transferred, but to where are transferred? To the other side? To the driver's buffer? And so on. :)

                        Most likelly, that a Windows reports this time is to more true than a Linux.

                        You can't relly on waitForBytesWritten and on this time, as all this is a hardware-drivers-specific, IMHO.

                        PS: You can try to calculate an overage transferring time and to compare it to your Eth bandwidth (is it ~1000Mbit? ~100Mbit? ~10Mbit? ...).

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #11

                        @kuzulis said in QTcpSocket waitForBytesWritten() is longer in Windows than Linux:

                        My assumption is that a Linux "lies", it reports that a data transferred, but to where are transferred? To the other side? To the driver's buffer? And so on. :)
                        Most likelly, that a Windows reports this time is to more true than a Linux.

                        I think you're being unfair on Linux and overly generous to Windows.

                        First of all, no it isn't to "the other side", it's only to the OS buffer. That is made quite clear. What the OS then does with it is another matter. If you want to know what is actually going on "on the line" you need to use WireShark under both OSes.

                        Secondly, @Ayse , http://doc.qt.io/qt-5/qabstractsocket.html#waitForBytesWritten

                        Note: This function may fail randomly on Windows. Consider using the event loop and the bytesWritten() signal if your software will run on Windows.

                        Doesn't give you much confidence for Windows, does it? If it can fail randomly, I wouldn't rely on it for your purposes too much....

                        1 Reply Last reply
                        2

                        • Login

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