You are suggesting that the problem is somewhere else then.

This is what happens:

1. When the 2 clients (program) are running in the same machine as the server, then the image is passed successfully.

2. When I run the server and 1 client in Linux, and the other client in Windows, then the program crashes.

When I pass regular text messages, then everything is fine, because the messages are small. I have a "cout<<" in the server that prints IMAGE everytime the payload is greater than 500.

readAll(); is executed everytime a payload arrives, so in the screen I see many IMAGE messages, because the image is large.

I thought that readAll(); will take care of it, but I may be wrong.

Qt Code:
  1. // Creates the needed connections
  2. void ClientThread :: iniConnections()
  3. {
  4. connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
  5. connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
  6. }
  7.  
  8.  
  9. // Reads all incoming data and passes it to the message class
  10. void ClientThread :: readData()
  11. {
  12. messageIn->clear();
  13. *messageIn = tcpSocket->readAll();
  14. if(messageIn->length() >= 500)
  15. {
  16. cout << "SCREENSHOT\n";
  17. remoteClientThread->directScreenshot(*messageIn);
  18. }
  19. else
  20. message->parseMessage(*messageIn);
  21. }
To copy to clipboard, switch view to plain text mode 

I know that the problem is in this readAll(); because the image is passed in pieces and the program cannot display those pieces.

How can I collect all the image coming from the remote computer in my QByteArray before passing the image to the label ?