I have the following code that reads from QTCPSocket:
QString request;
while(pSocket->waitForReadyRead())
{
request.append(pSocket->readAll());
}
The problem with this code is that it reads all the input and then stops at the end for 30 seconds. (Which is the default timeout.)
What is the correct way to avoid a long timeout and determine that the end of input has been reached? (An answer that avoids signals is preferable because it should happen synchronously in the stream.)
source
share