This slot has to put messages into buffer of a socket, but signal readyRead() is not send. I found out that size of written data the same as array size but method bytesAvailable() always returns zero. Can not understand why it happens
Code:
void Client::slotMessageSend()
{
QByteArray array;
QDataStream str(&array, QIODevice::WriteOnly);
str.setVersion(QDataStream::Qt_4_5);
str << quint16(0) << QTime::currentTime() << ui->textMessage->toPlainText() ;
str.device()->seek(0);
str << quint16(array.size() - sizeof(quint16));
cout << pClientSocket->write(array) << endl;
cout << array.size()<< " " << pClientSocket->bytesAvailable() << endl;
ui->textMessage->setPlainText("");
}
bytesAvailable()
will be>0
. – xander