title: Can't read data using TcpServer and TcpSocket
body: <p>I have a camera and want to send data to it but first I have to make a connexion between the camera's software (which is on my laptop) and my software so I need to open two sockets get data from.the software then send it to the camera.</p>
  
  <p><strong>sockettest.h:</strong></p>
  
  <pre><code>class SocketTest : public QObject{
  
      Q_OBJECT
      public:
      explicit SocketTest(QObject *parent = nullptr);
      bool start_listen(int);
      QTcpSocket *blutechnix;
      QTcpSocket *tof;
      QTcpServer *server;
      void incomingConnection();
      signals:
  
      public slots:
      void Connect();
      private:
  };
  
  
  SocketTest::SocketTest(QObject *parent) : QObject(parent){
  
      server = new QTcpServer(this);
      connect(server, SIGNAL(newConnection()),this, SLOT(Connect()));
      tof = new QTcpSocket(this);
      tof-&gt;connectToHost("192.168.0.10",10001);
      if(tof-&gt;waitForConnected(3000))
       {
      qDebug() &lt;&lt; "tof connected";
  
  
      if(server-&gt;listen(QHostAddress::LocalHost, 10000))
          {
              qDebug() &lt;&lt; "Listening...";
              qDebug() &lt;&lt; server-&gt;serverAddress();
              qDebug() &lt;&lt; server-&gt;serverPort();
          }
      }
      else
          {
              qDebug() &lt;&lt; "tof connexion failed";
          }
      tof-&gt;close();
  
      }
  
  
  sockettest.h:
  
  void SocketTest::Connect(){
  
      qDebug() &lt;&lt; "CONNECTED";
      blutechnix = server-&gt;nextPendingConnection();
      blutechnix-&gt;waitForReadyRead();
      QByteArray array =blutechnix-&gt;read(blutechnix-&gt;bytesAvailable());
      qDebug() &lt;&lt; array;
      //send all data to the camera
      tof-&gt;write(array);
      tof-&gt;waitForBytesWritten();
      //make sure that we wrote the right bytes
      tof-&gt;waitForReadyRead(3000);
      qDebug() &lt;&lt; "Reading tof" &lt;&lt; tof-&gt;bytesAvailable();
      qDebug() &lt;&lt; tof-&gt;readAll();
  
  }
  
  void SocketTest::incomingConnection() {
  
      if( ! blutechnix-&gt;setSocketDescriptor(server-&gt;socketDescriptor()) ) {
      QMessageBox::warning( (QWidget *)this-&gt;parent(), tr("Error!"), tr("Socket 
      error!") );
      return;
      }
  }
  </code></pre>
  
  <p>I run the code and I got as a result:</p>
  
  <blockquote>
    <p>tof connected
     Listening...
     QHostAddress&lt;"127.0.0.1"> 10000</p>
  </blockquote>
  
  <p>Why I can't see the data? why the <code>Connect()</code> function is not executed?
  I hope you could help me.</p>