summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-11-19 20:18:55 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-11-19 20:33:31 -0300
commitff7f570599f88b022dffa9e80d9b28c2933cc053 (patch)
tree15d5a360a91c703ad4032d68b69875856481a003 /doc/codesnippets/doc
parentc21497ec1a74552db43823857bec9bcdbb675038 (diff)
downloadpyside-ff7f570599f88b022dffa9e80d9b28c2933cc053.tar.gz
pyside-ff7f570599f88b022dffa9e80d9b28c2933cc053.tar.xz
pyside-ff7f570599f88b022dffa9e80d9b28c2933cc053.zip
Fixed codesnippte about return of QAbstractSocket.read function.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'doc/codesnippets/doc')
-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_()