summaryrefslogtreecommitdiffstats
path: root/examples/network/threadedfortuneserver
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-03-05 10:52:17 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2016-01-13 16:31:33 +0000
commit184d66caa5f7f93b7383319c5c8985524e0dc824 (patch)
tree272ce3f066d3c80f77dfca50fd0914b341c2f9da /examples/network/threadedfortuneserver
parentca6f11dcf207aa51ce32c9813ad1ab3790bb31ee (diff)
QDataStream: handle incomplete reads from QIODevice
This adds a way to resume reading from a stream after a ReadPastEnd error. This is done by introducing a stream read transaction mechanism that keeps read data in an internal buffer and rolls it back on failure. [ChangeLog][QtCore] Added QDataStream startTransaction(), commitTransaction(), rollbackTransaction(), abortTransaction() functions to support read transactions. Task-number: QTBUG-44418 Change-Id: Ibf946e1939a5573c4182fea7e26608947218c2d9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'examples/network/threadedfortuneserver')
-rw-r--r--examples/network/threadedfortuneserver/fortunethread.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/examples/network/threadedfortuneserver/fortunethread.cpp b/examples/network/threadedfortuneserver/fortunethread.cpp
index 5e70dd08b9..ec5bb5a168 100644
--- a/examples/network/threadedfortuneserver/fortunethread.cpp
+++ b/examples/network/threadedfortuneserver/fortunethread.cpp
@@ -63,10 +63,7 @@ void FortuneThread::run()
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
- out << (quint16)0;
out << text;
- out.device()->seek(0);
- out << (quint16)(block.size() - sizeof(quint16));
//! [3] //! [4]
tcpSocket.write(block);