title: Qt C++ unable to connect to QTcpServer using Telnet
body: <p>I have watched VoidRealm's Youtube video, <code>C++ Qt 67 - QTCPServer - a basic TCP server application</code> and followed his instructions, however, I can't connect to the QTcpServer I created using Telnet.</p>
  <p>My Code:</p>
  <pre class="lang-cpp prettyprint-override"><code>//myserver.h
  
  #ifndef MYSERVER_H
  #define MYSERVER_H
  
  #include &lt;QObject&gt;
  #include &lt;QDebug&gt;
  #include &lt;QTcpServer&gt;
  #include &lt;QTcpSocket&gt;
  
  class MyServer : public QObject
  {
      Q_OBJECT
  public:
      explicit MyServer(QObject *parent = nullptr);
  
      void newConnection();
  signals:
  
  private:
      QTcpServer *server;
  };
  #endif // MYSERVER_H
  
  </code></pre>
  <pre class="lang-cpp prettyprint-override"><code>//myserver.cpp
  
  #include &quot;myserver.h&quot;
  
  MyServer::MyServer(QObject *parent)
      : QObject{parent}
  {
      server = new QTcpServer(this);
  
      connect(server,SIGNAL(newConnection()),this,SLOT(newConnection()));
  
      if(!server-&gt;listen(QHostAddress::Any, 1234))
      {
          qDebug() &lt;&lt; &quot;Server could not start!&quot;;
      }else{
          qDebug() &lt;&lt; &quot;Server started!&quot;;
      }
  }
  
  void MyServer::newConnection()
  {
      QTcpSocket *socket = server-&gt;nextPendingConnection();
  
      socket-&gt;write(&quot;hello client\r\n&quot;);
      socket-&gt;flush();
  
      socket-&gt;waitForBytesWritten(3000);
  
      socket-&gt;close();
  }
  </code></pre>
  <p>Running this code, in the Console screen I get</p>
  <pre><code>qt.core.qobject.connect: QObject::connect: No such slot MyServer::newConnection() in ..\First_Server\myserver.cpp:8
  Server started!
  </code></pre>
  <p>but when I open a command prompt and do the following steps:</p>
  <pre><code>...&gt;telnet
  </code></pre>
  <pre><code>Welcome to Microsoft Telnet Client
  
  Escape Character is 'CTRL+]'
  
  Microsoft Telnet&gt; open 127.0.0.1 1234
  Connecting To 127.0.0.1...
  </code></pre>
  <p>It is not connecting.
  Can anyone tell me what I have done wrong?
  I am using Qt 6.3.0.</p>