summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets')
-rw-r--r--doc/codesnippets/doc/src/snippets/network/tcpwait.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/codesnippets/doc/src/snippets/network/tcpwait.cpp b/doc/codesnippets/doc/src/snippets/network/tcpwait.cpp
index 7ebdc69..0712b3e 100644
--- a/doc/codesnippets/doc/src/snippets/network/tcpwait.cpp
+++ b/doc/codesnippets/doc/src/snippets/network/tcpwait.cpp
@@ -51,13 +51,12 @@ def main():
//! [0]
numRead = 0
numReadTotal = 0
- buffer = ""
while(True):
- numRead = socket.read(buffer, 50)
+ buffer = socket.read(50)
# do whatever with array
- numReadTotal += numRead
- if (numRead == 0 && !socket.waitForReadyRead()):
+ numReadTotal += buffer.size()
+ if (buffer.size() == 0 && !socket.waitForReadyRead()):
break
//! [0]
return app.exec_()