QLocalSocket and QDataStream
Unsolved
General and Desktop
-
I am getting data from from QLocalSocket and try to put it to QDataStream. Then, I see data stream is empty, what I do wrong?
auto socket = qobject_cast<QLocalSocket*>(sender()); QByteArray bytes = socket->readAll(); QDataStream stream(&bytes, QIODevice::ReadOnly); qDebug() << bytes; // I got here while (!stream.atEnd()) { QString receiveString; stream >> receiveString; qDebug() << receiveString; // I not got here }
-
@aliks-os said in QLocalSocket and QDataStream:
I got
"Hello12345"That means that
bytes
is just an array of (ascii?) encoded bytes. this is not how you useQDataStream
normally.Could you show us the code for the other side of the connection? the one sending the "Hello12345"?