end-of-file

How to properly determine that the end-of-input has been reached in a QTCPSocket?

I have the following code that reads from a QTCPSocket: QString request; while(pSocket->waitForReadyRead()) { request.append(pSocket->readAll()); } The problem with this code is that it reads all of the input and then pauses at the end for 30 seconds. (Which is the default timeout.) What is the proper way to avoid the long timeo...