QByteArray in 2 parts?

0

Good afternoon, I'm doing an exercise that involves Serial Port, send and receive a chain, when sending the chain all right, but when I receive it I get it in 2 parts, both devices have the same configuration.

PuertoAP->setBaudRate(QSerialPort::Baud115200);
PuertoAP->setDataBits(QSerialPort::Data8);
PuertoAP->setParity(QSerialPort::NoParity);
PuertoAP->setStopBits(QSerialPort::OneStop);
PuertoAP->setFlowControl(QSerialPort::NoFlowControl);

It is a chain of 15 data, first arrive 8 and then 7, if I put the size of the string to 24 I split the chain into 3 parts of 8 data, Does anyone know what is due? Thank you very much for your time.

    
asked by Aarón Gutiérrez 05.10.2017 в 19:46
source

1 answer

1
  

Does anyone know what is due?

It's because that's how it works. The data is never sent integer, if not in packages, whether you want to send several gigas of information or send small chains.

What should you do?

Normally, by implementing this type of communication, the messages are sent with a header that includes the size of the information to be received and the information received is not considered until the complete data has been obtained.

    
answered by 05.10.2017 / 20:13
source