void ThreadPort::run(){ quint8 ch; …………. QDataStream stream(port); stream.setVersion(QDataStream::Qt_4_1); stream.setDevice(port); stream.setByteOrder(QDataStream::LittleEndian); char buf_r[1]; int numBytes; numBytes = port->bytesAvailable(); if (numBytes > 0) { numBytes = 1; stream >> ch; stream.readRawData(buf_r, numBytes); int i = port->read(buf_r, numBytes); if (i != -1) buf_r[i] = '\0'; ………………..