void Thread::run(){ qDebug()<<"Thread::run "; ... while(socket->state()==QAbstractSocket::ConnectedState) { qDebug()<<"socket may read?"<<socket->state(); if( this->socket->waitForReadyRead(1000)) { int av=socket->bytesAvailable(); qDebug()<<"Reading from socket bytes: "<<av; QByteArray ara; do{ ara= socket->read(av); }while(ara.count()<av); qDebug()<<ara; QString str(ara); qDebug()<<"do addString "<<str; if(str.isEmpty()) continue; ... } ...
void Thread::run(){ QTcpSocket socket; connect( &socket, SIGNAL( readyRead() ), this, SLOT( OnReadyRead() ), Qt::QueuedConnection ); exec()}
QByteArray ara; do{ ara= socket->read(av); }while(ara.count()<av); qDebug()<<ara; ...
... ara += socket->read(av); ...