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. why when i send large string on Qserial port the string is send in different random parts...
Forum Updated to NodeBB v4.3 + New Features

why when i send large string on Qserial port the string is send in different random parts...

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 289 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.
  • stackprogramerS Offline
    stackprogramerS Offline
    stackprogramer
    wrote on last edited by stackprogramer
    #1

    why when i send large string on Qserial port the string is received in different random parts...
    some time all string is received some time it received in multi step so for more info see image............

    alt text

    JonBJ 1 Reply Last reply
    0
    • stackprogramerS stackprogramer

      why when i send large string on Qserial port the string is received in different random parts...
      some time all string is received some time it received in multi step so for more info see image............

      alt text

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @stackprogramer
      Do you really mean "random"? To be clear, all the bytes, and no others, are actually received, right? Then it depends on buffering/timing/packeting how those bytes arrive, you should not assume that one write corresponds to one read, especially if the volumes are high.

      1 Reply Last reply
      0
      • stackprogramerS Offline
        stackprogramerS Offline
        stackprogramer
        wrote on last edited by stackprogramer
        #3

        I want to get a string 20 byte first step that i received but it can not received in one step
        some time on step i received and some time i received in multi step...
        i search and saw this method but i want to serial port can read 20 byte or more or not
        detect automaticly..........not this method...

        i define some AT command 20byte so i need this case.......
        
           if (serialPort->bytesAvailable() < 3+3 ){
                        return;
                    }
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Since it's a stream you can't send 'pakets'. You have to use bytesAvailable() or use a local own buffer and parse this.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3

          • Login

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