restructuring the receive event loop.
* Call waitForReadyRead repeatedly until we know we have reached the end.