

Where the run() function is the same as the above code.

QByteArray sentData( nextStep( data, bRunning ) ) Īgain, we observe a longer communication, but it still fails.Īs a 3d implementation, the above code for a blocking-mode communication is used in a simple console application where the Qt process loop is NOT used. If ( pPort ->open( QIODevice::ReadWrite ) ) PPort->setFlowControl(mSettings.flowControl)

Other observation : If the emission of the 2 dataRead and dataSent signals (at the end of the code) is removed, the communication lasts longer !Īs a 2d implementation, a QThread is created to manage the full communication in a blocking mode : simplified code : pPort->setPortName(mSettings.name) If the communication lasts long enough, the timeout in the waitForBytesWritten call starts to expire. At reception of the readyRead signal, simplified code : QByteArray data( pPort->readAll() ) Īfter a while, the 1st symptom is the other device starting to resend its requests, just as if the answer was not correctly sent. The communication starts correctly and after a while (sometimes 2 or 3 exchanges, sometimes about 300 exchanges), we observe that the developed client sounds to slow down.Īs a 1st implementation, the handy signals-slots system was used. QSerialPort failed to handle long communication with many exchanges.
