It seems that the problem was in QTextStream::readLine().

It first received two complete lines in the buffer, but QTextStream::readLine() read the first the line and the rest was discarded. I used instead QTcpSocket::readLine() and the problem has gone, now I can read from the server without problems.

Now I'm wondering what's the advantage of using a QTextStream over a QTcpSocket...