I'm trying to get my MainWindow application launch a few TcpServer threads to wait for connections and go from there.

I am able to connect to the open port, but nothing gets triggered inside of Qt for me to go any further.

MainWindow.cpp:
Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include "serverlistener.h"
  4. #include <QtNetwork/QTcpServer>
  5.  
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11.  
  12. if (!serverListener.listen(QHostAddress::LocalHost, 5600)) {
  13. qCritical("Error opening port 5600.");
  14. serverListener.close();
  15. return;
  16. }
  17. }
  18.  
  19. MainWindow::~MainWindow()
  20. {
  21. delete ui;
  22. }
To copy to clipboard, switch view to plain text mode 

MainWindow.h:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include "serverlistener.h"
  6.  
  7. class ServerListener;
  8. namespace Ui {
  9. class MainWindow;
  10. }
  11.  
  12. class MainWindow : public QMainWindow
  13. {
  14. Q_OBJECT
  15.  
  16. public:
  17. explicit MainWindow(QWidget *parent = 0);
  18. ~MainWindow();
  19.  
  20. private:
  21. Ui::MainWindow *ui;
  22. ServerListener serverListener;
  23.  
  24. };
  25.  
  26. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

ServerListener.cpp:
Qt Code:
  1. #include "serverlistener.h"
  2. #include "mainwindow.h"
  3. #include <iostream>
  4. #include <QDebug>
  5.  
  6. using namespace std;
  7.  
  8. ServerListener::ServerListener(QObject *parent) :
  9. QTcpServer(parent)
  10. {
  11. // serverSocket = new QTcpServer(this);
  12.  
  13. cout << "Listening" << endl;
  14. }
  15.  
  16. ServerListener::~ServerListener() {
  17. cout << "Destruction" << endl;
  18. serverSocket->close();
  19. }
  20.  
  21. void ServerListener::incomingConnection(int descriptor) {
  22.  
  23. cout << "Incoming connection" << endl;
  24. //ServerThread *thread = new ServerThread(descriptor, this);
  25.  
  26. }
To copy to clipboard, switch view to plain text mode 

ServerListener.h:
Qt Code:
  1. #ifndef SERVERLISTENER_H
  2. #define SERVERLISTENER_H
  3.  
  4. #include <QtNetwork/QTcpServer>
  5. #include <QObject>
  6.  
  7. class ServerListener : public QTcpServer
  8. {
  9. Q_OBJECT;
  10. public:
  11. explicit ServerListener(QObject *parent = 0);
  12. ~ServerListener();
  13.  
  14. protected:
  15. void incomingConnection(int descriptor);
  16.  
  17. private:
  18. QTcpServer *serverSocket;
  19. };
  20.  
  21. #endif // SERVERLISTENER_H
To copy to clipboard, switch view to plain text mode 

Here's my goal:

Qt Code:
  1. [listen1]<-------|MainWindow|------->[listen2]
  2.  
  3. [client1->listen1]
  4. [client2->listen2]
  5. [client3->listen1]
  6. ...
  7. [client10->listen1]
To copy to clipboard, switch view to plain text mode 

Basically, I want to make sure the listening functions don't block the rest of the application. The program I'm making is quite advanced and this is my first time using Qt. I absolutely love the language and editor, which is why I chose it over VS2010 or VC#. I just hope I can accomplish what I have in mind (arrays/structs of sockets and structuring communication between them as needed).

Thanks.