The incomingConnection() slot is wrong.

It creates an unconnected QTcpSocket, it should be retrieving the server side end point of the incoming client connection using QTcpServer::nextPendingConnection().

Basically instead of
Qt Code:
  1. QTcpSocket *client = new QTcpSocket(this);
To copy to clipboard, switch view to plain text mode 
you have
Qt Code:
  1. QTcpSocket *client = tcpServer->nextPendingConnection();
To copy to clipboard, switch view to plain text mode 

Cheers,
_