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.
// Creates the needed connections
void ClientThread :: iniConnections()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
}
// Reads all incoming data and passes it to the message class
void ClientThread :: readData()
{
messageIn->clear();
*messageIn = tcpSocket->readAll();
if(messageIn->length() >= 500)
{
cout << "SCREENSHOT\n";
remoteClientThread->directScreenshot(*messageIn);
}
else
message->parseMessage(*messageIn);
}
// Creates the needed connections
void ClientThread :: iniConnections()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
}
// Reads all incoming data and passes it to the message class
void ClientThread :: readData()
{
messageIn->clear();
*messageIn = tcpSocket->readAll();
if(messageIn->length() >= 500)
{
cout << "SCREENSHOT\n";
remoteClientThread->directScreenshot(*messageIn);
}
else
message->parseMessage(*messageIn);
}
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 ?
Bookmarks