My question is simple, I suppose, but I can't figure out why this is happening.

I have a QTcpServer:

Qt Code:
  1. //server initialization
  2. server= new QTcpServer();
  3. bool success = server->listen(QHostAddress::Any, 10101);
  4.  
  5. if(!success)
  6. {
  7. ui->textEdit->setTextColor(Qt::red);
  8. ui->textEdit->append(" > Could not create TopMovie Server! \n Reason: TopMovie Server is already running! \n\n This Window will automatically close!");
  9. ui->textEdit->setTextColor(Qt::black);
  10. QTimer *timer = new QTimer(this);
  11. connect(timer, SIGNAL(timeout()), this, SLOT(sterge_server()));
  12. timer->start(3000);
  13. }
  14. else
  15. {
  16. ui->textEdit->setTextColor(Qt::white);
  17. ui->textEdit->append(" > TopMovie Server Online!");
  18. connect(server, SIGNAL(newConnection()), this, SLOT(incomingConnection()));
  19. ui->textEdit->setTextColor(Qt::black);
  20. DataBase();
  21. }
  22.  
  23. //incomingConnection
  24. void TopMovieS::incomingConnection()
  25. {
  26. int Socketfd=server->nextPendingConnection()->socketDescriptor();
  27. QTcpSocket *client = new QTcpSocket(this);
  28. client->setSocketDescriptor(Socketfd);
  29. clients.insert(client);
  30.  
  31. string adresa=" > New client from: "+client->peerAddress().toString().toStdString();
  32. ui->textEdit->setTextColor(Qt::yellow);
  33. ui->textEdit->append(adresa.c_str());
  34. ui->textEdit->setTextColor(Qt::black);
  35.  
  36. connect(client, SIGNAL(readyRead()), this, SLOT(readyRead()));
  37. connect(client, SIGNAL(disconnected()), this, SLOT(disconnected()));
  38. }
To copy to clipboard, switch view to plain text mode 

I read on QTcpServer Documentation that I have to call nextPendingConnection() instead of IncommingConnection(). And also IncommingConnection() needs a QTcpSocket parameter... Anyway, this code on Windows gives a warning every time a new client is connecting: "QSocketNotifier: Multiple socket notifiers for same socket 768 and type Read", but it still works.

On Ubuntu the same code doesn't work. It gives the same error, but doesn't continue: "QSocketNotifier: Invalid socket 24 and type 'Read', disabling..."

Please help me, I am new to Qt and this is my first QTcpServer. I didn't understood everything from documentation, so the code is, I suppose, wrong.

Thank you!