void Client::readFortune()
{
char temp[30];
int flag = 0;
char temp2[4] = {0x01, 0x02, 0x03, 0x04};
if (blockSize == 0) {
if (tcpSocket->bytesAvailable() < (int)sizeof(quint16))
return;
in >> blockSize;
}
flag = tcpSocket->readLine(temp, 31);// i'm trying to read the receive buffer here and show it below
if(flag |= -1){
messageLineEdit
->setText
(QString::number(blockSize
));
// I can see the block size, 1537 statusLabel
->setText
(QString::fromAscii(temp2,
4));
}
if (tcpSocket->bytesAvailable() < blockSize)
return;
in >> nextFortune;
if (nextFortune == currentFortune) {
QTimer::singleShot(0,
this,
SLOT(requestNewFortune
()));
return;
}
currentFortune = nextFortune;
statusLabel->setText(currentFortune);
getFortuneButton->setEnabled(true);
}