Now I see the point and I am slowly moving to the idea you presented. But I have a problem constructing the while loop which is suppose to get the size of the next incoming data I tried this but I know that fails:
void Server::onreadyRead()
{
while(buffer.size() < (int)sizeof(quint64))
{
clientSocket->waitForReadyRead(1);
blockSizee.append(clientSocket->readAll());
}
}
QByteArray buffer;
void Server::onreadyRead()
{
while(buffer.size() < (int)sizeof(quint64))
{
clientSocket->waitForReadyRead(1);
blockSizee.append(clientSocket->readAll());
}
}
To copy to clipboard, switch view to plain text mode
TEST:
The byte size of the "size information", sended by server, is about 8kB but after first readyRead signal client gets first 4kB, and after second signal buffer meets the while condition and skips it, and I can't get the full right size.
Bookmarks