Question about QDataStream and its functions startTransaction and commitTransaction
Unsolved
General and Desktop
-
Hi,
I found the following code in the example https://code.qt.io/cgit/qt/qtbase.git/tree/examples/network/fortuneclient/client.cpp?h=5.15,... connect(tcpSocket, &QIODevice::readyRead, this, &Client::readFortune); ... void Client::readFortune() { in.startTransaction(); QString nextFortune; in >> nextFortune; if (!in.commitTransaction()) return; if (nextFortune == currentFortune) { QTimer::singleShot(0, this, &Client::requestNewFortune); return; } currentFortune = nextFortune; statusLabel->setText(currentFortune); getFortuneButton->setEnabled(true); }
The issue I am having is in.commitTransaction() always return false, the size of the tcpsocket buffer keeps increasing and nextFortune size is always 0.
Any help I really appreciate it.
Thanks
-
So how do you send your data?