Could you help me understand the fortune client example? Here's the readFortune() code with a few of my comments and questions, can you tell me if I understood the code correctly?

Qt Code:
  1. void Client::readFortune()
  2. {
  3. QDataStream in(tcpSocket);
  4. in.setVersion(QDataStream::Qt_4_0);
  5.  
  6. if (blockSize == 0) {
  7. /*
  8. If the size of the data received is less than what is required to store the block size, do nothing
  9. */
  10. if (tcpSocket->bytesAvailable() < (int)sizeof(quint16))
  11. return;
  12.  
  13. in >> blockSize;
  14. }
  15.  
  16. /*
  17.   Is this where the buffering takes place?
  18.   bytesAvailable() return will grow each time readyRead() is emitted, until its value is equal to blockSize
  19.   */
  20. if (tcpSocket->bytesAvailable() < blockSize)
  21. return;
  22.  
  23. QString nextFortune;
  24. /*
  25.   This is where the data is read.
  26.   If we reach this part of the code, it means we have the complete data, and its safe to read and use it.
  27.   */
  28. in >> nextFortune;
  29.  
  30.  
  31. /*
  32.   Why use QTimer and not call requestNewFortune() directly?
  33.   */
  34. if (nextFortune == currentFortune) {
  35. QTimer::singleShot(0, this, SLOT(requestNewFortune()));
  36. return;
  37. }
  38.  
  39. currentFortune = nextFortune;
  40. statusLabel->setText(currentFortune);
  41. getFortuneButton->setEnabled(true);
  42. }
To copy to clipboard, switch view to plain text mode