Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • 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



  • @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.



  • 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;
                }
    

  • Qt Champions 2019

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


Log in to reply