[Interest] QCborValue is not suitable for using in sockets data exchange?

Alexander Dyagilev alervdvcw at gmail.com
Thu May 19 18:41:03 CEST 2022


Hello,

One can easily write it to socket. E.g.

socket->write(value.toCbor());

But how to read it then? It seems it's not possible.

I.e. the following solution:

MyClient::MyClient()
{
       QCborStreamReader cborReader = new QCborStreamReader(socket);
}

MyClient::onReadyRead()
{
    QCborValue::fromCbor(cborReader);
}

Seems to be wrong. I.e. there can situation that data for the current 
item is not completely received yet. What happens then? It seems thing 
will stop working, because QCborValue::fromCbor can't resume from the 
point it stopped due to EndOfFile.

Am I right? And one just has to use plain 
QCborStreamReader/QCborStreamWriter.




More information about the Interest mailing list