Hello everybody.

I know there were many topics with similar subjects, but I can't seem to find an answer for my problems so... here we are.

I want to create application, that would be able to download images from the internet. I know I could use QNetworkManager, but I would like to display image as soon as some part of it gets downloaded (like most browsers do), and QNetworkManager seems to display image after download is complete, so I want to try QTcpSocket. As a test, I am trying to download this image:

http://www.google.pl/images/srpr/nav_logo73.png

Here is some code:

Qt Code:
  1. QTcpSocket socket;
  2. connect(&socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError)));
  3. socket.connectToHost("www.google.pl",80,QIODevice::ReadWrite);
  4. socket.waitForConnected();
  5.  
  6. socket.write("GET /images/srpr/nav_logo73.png");
  7.  
  8. socket.waitForReadyRead();
  9. ba=socket.readAll();
  10. MB.setText(QString(ba));
  11. MB.exec();
  12.  
  13. .
  14. void MainWindow::error(QAbstractSocket::SocketError socketError)
  15. {
  16. MB.setText("Error! "+QString::number(socketError));
  17. MB.exec();
  18. }
To copy to clipboard, switch view to plain text mode 

Of course the above is meant to display any data that gets to the byteArray, but even this doesn't work, I got "SocketTimeoutError". What am I doing wrong?

Thanks in advance.