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 readready signal

qtcpsocket readready signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 591 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.
  • S Offline
    S Offline
    Sunfluxgames
    wrote on last edited by
    #1

    Every time the signal is hit the packets are getting bunched up into one big buffer..

    Example : 8 bytes sent then 30bytes sent (2 individual packets) readready shows 38 total, instead of 8 and 30.

    Is there a way to fix this?

    Currently i split up the buffer using "read" to read when bytes are available. The readall bunches them up as well. Is there any other work around for this.

    K 1 Reply Last reply
    0
    • S Sunfluxgames

      Every time the signal is hit the packets are getting bunched up into one big buffer..

      Example : 8 bytes sent then 30bytes sent (2 individual packets) readready shows 38 total, instead of 8 and 30.

      Is there a way to fix this?

      Currently i split up the buffer using "read" to read when bytes are available. The readall bunches them up as well. Is there any other work around for this.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Sunfluxgames

      The readyRead signal is not packet oriented as you expect.

      It simply indicates that there is something to read, nothing and nothing less. When it is triggered depends on the speed of the reading processor, respectively the availability of the event loop. Theoretically you might be able to catch a signal byte, but is very unlikely. Possible it might be probable with a very low rate serial port.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Sunfluxgames
        wrote on last edited by
        #3

        What would be the best option? Create a qbytearray use mid to break up the data base on the size and process it however I want.

        K 1 Reply Last reply
        0
        • S Sunfluxgames

          What would be the best option? Create a qbytearray use mid to break up the data base on the size and process it however I want.

          K Offline
          K Offline
          koahnig
          wrote on last edited by koahnig
          #4

          @Sunfluxgames

          This typically depends on your needs and the speed of incoming data. You can use bytesAvailable to check the size of the QTcpSocket buffer content.

          An additional QByteArray is probably not required, but again that depends on your application and communication line. In most cases you probably you might have to wait a short momentfor receiving all 38 bytes.

          If you receive always 38 bytes at a certain let's assume once pe second, you probably need a loop reading. The tricky part is that none of those layers knows the details of your data. Therefore, you have totake care of.

          Note: you will not receive an additional readyRead signal while you are processing the data in your slot routine. Therefore, you need to take care of this yourself.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          4

          • Login

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