Code: Alles auswählen
QTcpSocket *con = m_tcpserver->nextPendingConnection();
connect(con, SIGNAL(disconnected()), con, SLOT(deleteLater()));
QDataStream *in = new QDataStream(con);
in->setVersion(QDataStream::Qt_4_4);
QString *str = new QString("");
char* tmp = "";
quint32 blockSize = 1024;
while(con->bytesAvailable() >= blockSize) {
in->readBytes(tmp, blockSize);
str->append(tmp);
qDebug(tmp);
}
blockSize = (quint32) con->bytesAvailable();
in->readBytes(tmp, blockSize);
str->append(tmp);
con->disconnectFromHost();
qDebug((char*) str);Edit: Es kommt immer irgendein Zeichensalat raus (Ausgabe von qDebug): 4Á0j^