i' sorry .

this is the original code :

a part of simplechatclient.cpp :
Qt Code:
  1. void SimpleChatClient::sendMessage()
  2. {
  3. // "<nick> message\n"
  4. socket->write("<" + nick->text().toLatin1() + "> " + message->text().toLatin1() + "\n");
  5. message->clear();
  6. }
  7.  
  8. void SimpleChatClient::receiveMessage()
  9. {
  10. // missing some checks for returns values for the sake of simplicity
  11. qint64 bytes = buffer->write(socket->readAll());
  12. // go back as many bytes as we just wrote so that it can be read
  13. buffer->seek(buffer->pos() - bytes);
  14. // read only full lines, line by line
  15. while (buffer->canReadLine())
  16. {
  17. QString line = buffer->readLine();
  18. chat->append(line.simplified());
  19. }
  20. }
To copy to clipboard, switch view to plain text mode 

a part of simplechatsever.cpp :

Qt Code:
  1. void SimpleChatServer::receiveMessage()
  2. {
  3. QTcpSocket* socket = static_cast<QTcpSocket*>(sender());
  4. QBuffer* buffer = buffers.value(socket);
  5.  
  6. // missing some checks for returns values for the sake of simplicity
  7. qint64 bytes = buffer->write(socket->readAll());
  8. // go back as many bytes as we just wrote so that it can be read
  9. buffer->seek(buffer->pos() - bytes);
  10. // read only full lines, line by line
  11. while (buffer->canReadLine())
  12. {
  13. QByteArray line = buffer->readLine();
  14. foreach (QTcpSocket* connection, connections)
  15. {
  16. connection->write(line);
  17. }
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

I had fix only at these methods And declare quint32 blockSize in the header file.