Many thanks Wysota for your reply.
This is the situation. I have written a code of a mini chat. In this code, I wanted to be able to transfert data to clients. What I have sent was just a piece of my code. This piece of code should open a directory, read a file, copy it and sent it to different cilents.
I did not send the piece of code of the server, just part for the client.
I would appreciate your help.
Reception slot
Sending slotvoid WinClient::MessageRecieved()
{
QString messageRecived;
QDataStream in(m_socket);
if(sizeMessage == 0)
{
if(m_socket->bytesAvailable() < (int)sizeof(quint16))
{
return;
}
in>>sizeMessage;
}
if(m_socket->bytesAvailable() < sizeMessage)
{
return;
}
in >> messageRecieved;
m_zoneMessage->append(messageRecu);
sizeMessage = 0;
}
Many thanks in advancevoid WinClient::clicOnBoutonConnection()
{
m_zoneMessage->append(tr("<em>Attempt of connexion...</em>"));
m_boutonConnexion->setEnabled(false);
m_socket->abort();
m_socket->connectToHost(m_textIp->text(), m_ServerPort->value());
}
Bookmarks