title: QTcpServer not working
body: <p>I'm trying to create a TCP server in C++ with QT. I have the code but as soon as I try to connect to the server with SocketTest it says connection refused (most likely due to the server not running).</p>
  
  <p>This is in my tcplistener.h:</p>
  
  <pre><code>#ifndef TCPLISTENER_H
  #define TCPLISTENER_H
  
  #include &lt;QtNetwork/QTcpSocket&gt;
  #include &lt;QtNetwork/QTcpServer&gt;
  
  class tcp_listener : public QTcpServer
  {
      Q_OBJECT
  signals:
  public slots:
      void newConnectionFromServer()
      {
          QTcpSocket* newConnection = nextPendingConnection();
          qDebug("New connection from %d", newConnection-&gt;peerAddress().toIPv4Address());
      }
  public:
      tcp_listener(QObject *parent = 0)
          : QTcpServer(parent)
      {
          listen(QHostAddress::Any, 30000);
          connect(this, SIGNAL(newConnection()),    SLOT(newConnectionFromServer()));
      }
  };
  
  #endif // TCPLISTENER_H
  </code></pre>
  
  <p>This is in my engine.h:</p>
  
  <pre><code>#ifndef ENGINE_H
  #define ENGINE_H
  
  #include &lt;QCoreApplication&gt;
  
  #include "tcplistener.h"
  
  class engine
  {
  public:
      void init()
      {
          qDebug("Initializing AuraEmu...");
  
          tcp_listener list();
      }
  };
  
  #endif // ENGINE_H
  </code></pre>
  
  <p>And this is my main.cpp:</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  
  #include "engine.h"
  
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
  
      engine eng = engine();
      eng.init();
  
      return a.exec();
  }
  </code></pre>
  
  <p>Anybody know what the problem is?</p>