diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-12-09 10:05:03 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-12-09 10:07:19 (GMT) |
commit | b9080b96b05988776daec35f7e2af9ad346abb0a (patch) | |
tree | 63410cfeb10d51d83a4189739c35d1b10d0d3d01 /tests/manual | |
parent | 92f11bd666e8a63d9fc8c5588d843721c5bf68b5 (diff) | |
download | Qt-b9080b96b05988776daec35f7e2af9ad346abb0a.zip Qt-b9080b96b05988776daec35f7e2af9ad346abb0a.tar.gz Qt-b9080b96b05988776daec35f7e2af9ad346abb0a.tar.bz2 |
Fix bug in select
When waitForRead was called, it was selecting for read and write,
because we were checking the pointers instead of the bools.
Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/socketengine/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/manual/socketengine/main.cpp b/tests/manual/socketengine/main.cpp index e475942..2f017a0 100644 --- a/tests/manual/socketengine/main.cpp +++ b/tests/manual/socketengine/main.cpp @@ -109,10 +109,12 @@ int main(int argc, char**argv) } // wait for connected - socketEngine->connectToHost(QHostAddress("74.125.77.99"), 80); // google + int r = socketEngine->connectToHost(QHostAddress("74.125.77.99"), 80); // google bool readyToRead = false; bool readyToWrite = false; socketEngine->waitForReadOrWrite(&readyToRead, &readyToWrite, true, true, 10*1000); + if (r <= 0) //timeout or error + exit(1); if (readyToWrite) { // write the request QByteArray request("GET /robots.txt HTTP/1.0\r\n\r\n"); @@ -129,7 +131,11 @@ int main(int argc, char**argv) bzero(buf, bufsize); ret = socketEngine->read(buf, available); if (ret > 0) { +#ifdef Q_OS_SYMBIAN + qDebug() << buf; //printf goes only to screen, this goes to remote debug channel +#else printf("%s", buf); +#endif } else { // some failure when reading exit(1); |