QTcpSocket read QByteArray

  • Hi. I need to read from socket QByteArray, qUncompress() it and pick three QStrings from it.
    My pseudo-code:
    QDataStream in(socket);
    if (blockSize == 0) {
    if (sock->bytesAvailable() < (int)sizeof(quint16))
    in >> blockSize;
    if (sock->bytesAvailable() < blockSize)
    blockSize = 0;
    QByteArray data;
    in >> data;
    QTextStream text(&data);
    text >> str >> str2 >> str3;

    How can I do it?

  • Moderators

    Do you see any problems when using an implementation based on your pseudo-code?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.