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. [Solved] QTcpSocket - Very Fast Transfer
QtWS25 Last Chance

[Solved] QTcpSocket - Very Fast Transfer

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.9k 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.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    I have an external program (using WinSocket) that sends data to my Qt server program. The client is sending data packets very quickly after each other (in a loop). Now the problem seems that my Qt server is not getting all the data, or at least the readyRead() signal is not always emitted. So if my client sends 5 data packets after each other, the readyRead() signal is only emitted between 1 and 3 times (can vary, probably depending on the execution of the client).

    Is this a bug or can I set something in QTcpServer/QTcpSocket to eliminate this problem?

    I think that if the data comes in too quickley, the buffer in QTcpSocket is overridden by the new data. Is this assumption correct? From a networking prespective, what would one do about this? I thought of returing a notification on each data packet. Hence the client will send and then wait for a confirmation from the server until a new packet is send. However, this will drastically reduce the speed of communication (since we always have to send confirmations back to the client). Any better solution?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      what is the issue you are facing ? Are you not getting all the data ?

      bq. I think that if the data comes in too quickley, the buffer in QTcpSocket is overridden by the new data.

      TCP buffer will not be overwritten. Client needs to read the data. If client is slow, TCP itself get's in and request the server not send data(TCP window size zero)

      bq. I thought of returing a notification on each data packet. Hence the client will send and then wait for a confirmation from the server until a new packet is send. However, this will drastically reduce the speed of communication (since we always have to send confirmations back to the client). Any better solution?

      Since it is TCP connection, TCP protocol layer is already doing what you are thinking.

      It all goes back to the issue you are facing.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goocreations
        wrote on last edited by
        #3

        Never mind. Seems that there was a problem with my WinSock client, which caused the buffer to be overridden, and then the overriden buffer was send to my Qt buffer. So not a Qt problem. Solved!

        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