Hi SIFE, here you go.

You have two main problems in you code (both in server and client), but don't worry you have done most of it, all the problems are small, may be you just need figure things out

1. Both in server and client project, the "GuiClient", and "GuiServer" classes, are multiple inherited from QMainWindow, and Ui:GuiServer/Ui::GuiClient. You also have a member variable as Ui:GuiServer*/Ui::GuiClient* ui. This is not good, you already have ui instance from the inherited call Ui:GuiServer/Ui::GuiClient

Fix: You either have Ui:GuiServer/Ui::GuiClien as a base class (or) have ui as a member variable, but not both. This was the main problem. You tried to do a new Ui:GuiServer/Ui::GuiClien in the constructor, and then use the setupUi(), which is actually calling the base class method (you should be calling ui->setupUi(this)).

So just have only one the things, having both is not good.

2. In server code, you are trying to override (re-implement) incomingConnection() (which is a virtual member of QTcpServer), this will not work as GuiServer is not a sub-class of QTcpServer.

Fix: The better way would be to make incomingConnection(), as a slot in GuiServer, and connect server.newConnection() signal to this.incomingConnection(), as shown below, also modify the GuiServer::incomingConnection() accordingly.

Qt Code:
  1. void GuiServer::startServer()
  2. {
  3. //bool stat = server->listen(QHostAddress::Any, quint16(portEdit->text().toUShort()));
  4. bool stat = server->listen(QHostAddress::Any, 5000);
  5. qDebug("%d", stat);
  6. /* if(!stat)
  7.   QMessageBox::critical(this, "Error to bind port", "Fail to listen");
  8.   else
  9.   {
  10.   startButton->setEnabled(false);
  11.   stopButton->setEnabled(false);
  12.   }
  13. */
  14. connect(server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); //Added
  15. }
  16.  
  17. void GuiServer::incomingConnection(void)
  18. {
  19. QTcpSocket *client = server->nextPendingConnection(); //modified
  20.  
  21. qDebug() << "New client from:" << client->peerAddress().toString();
  22.  
  23. connect(client, SIGNAL(readyRead()), this, SLOT(readMsg()));
  24. connect(sendButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
  25. connect(client, SIGNAL(disconnected()), this, SLOT(disconnected()));
  26. }
To copy to clipboard, switch view to plain text mode 

With these changes, I was able to send text form client to server. I guess you can carry on from here

Good Luck.