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. Packet rate using QTcpSocket
Qt 6.11 is out! See what's new in the release blog

Packet rate using QTcpSocket

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.2k Views
  • 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.
  • Q Offline
    Q Offline
    qmmj
    wrote on last edited by
    #1

    Hi,
    I'm transferring data from a measurement server (Raspberry PI 3) to a client (Windows 7) using a QTcpSocket.
    The data is a few bytes approximately every 30 ms. Each time I call write(data) on the QTcpSocket. The data reaches the client with an increasing delay. Wireshark shows me approximately one package each 200 ms.

    My object and conditions:
    A camera records a frame each 30 ms and the server has to send position information for each frame. Both transfer goes through one common GBit network interface (and a switch). The camera is consuming most of the bandwith, but the VPN link to the server still shows no delay.

    Do you have a hint, how to to transfer the measurement data in real time (ideally once each frame)?

    m.sueM 1 Reply Last reply
    0
    • Q qmmj

      Hi,
      I'm transferring data from a measurement server (Raspberry PI 3) to a client (Windows 7) using a QTcpSocket.
      The data is a few bytes approximately every 30 ms. Each time I call write(data) on the QTcpSocket. The data reaches the client with an increasing delay. Wireshark shows me approximately one package each 200 ms.

      My object and conditions:
      A camera records a frame each 30 ms and the server has to send position information for each frame. Both transfer goes through one common GBit network interface (and a switch). The camera is consuming most of the bandwith, but the VPN link to the server still shows no delay.

      Do you have a hint, how to to transfer the measurement data in real time (ideally once each frame)?

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi @qmmj

      increasing delay means that something needs more time every call. You should search for a structure, string etc. that gets bigger during the run. Could be a memory leak. I e.g. once had a string that got appended to every call which needed more and more time every call.

      -Michael.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qmmj
        wrote on last edited by
        #3

        Hi m.sue,

        that is what I wanted to express: The increasing delay means, that there is somewere a sending queue, which is filled faster (30 ms) than data is removed (200 ms).
        This assumed queue is not part of my written code. A poor solution would be to reduce the filling rate by accumulating multiple data. In that case the delay is still 200 ms and I don't know how this behaves under other conditions.
        A good solution would be to know where this delay comes from and to reduce it.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qmmj
          wrote on last edited by
          #4

          Hi,

          I just learned about the Nagle's algorithm and the QAbstractSocket::LowDelayOption.

          Now it works fine. Thanks.

          qmmj

          1 Reply Last reply
          1

          • Login

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