title: Qt multithreading QThreads that keep a TCP connection and are reused
body: <p>I'm really unsure of how to address this problem so i will explain it first.
  I need to run a number of threads that each connect to some application via TCPSocket, so far no problem. The application is quite time consuming that is why i want it to run parallel on multiple threads and one thread each to communicate with it. Once the computation is finished i want to send the results to another thread collecting the results.
  Therefor i wrote a Worker class:</p>
  
  <pre><code>class Worker : public QObject {
      Q_OBJECT
  
  public:
      Worker();
      Worker(int port);
      ~Worker();
      QTcpSocket* sock;
      void insert();
  
  public slots:
      void connect();
      void process(const int &amp;id, const QString &amp;param, const int &amp;arity);
  
  signals:
      void ready();
      void finished(const int &amp;id, const int &amp;consistent, const QString &amp;result);
      void error(QString err);
  };
  </code></pre>
  
  <p>Now that superThread is supposed to work off a huge file and needs to spread it around the threads, and then receive and handle the results. My approach so far is another superThread that is connected in the main() as follows:</p>
  
  <pre><code>QThread* superThread = new QThread();
  supWorker* super = new supWorker();
  for (int i = 0; i &lt; nrWorkers; i++){
      Worker* worker = new Worker(portRange+i);
      QThread* workerThread = new QThread();
      QThread::connect(workerThread, SIGNAL(started()), worker, SLOT(connect()));
      worker-&gt;moveToThread(workerThread);
      workerThread-&gt;start();
      QThread::connect(super, SIGNAL(process(int, QString, int)), worker, SLOT(process(int,QString,int)));
      QThread::connect(worker, SIGNAL(finished(int, int, QString)), super, SLOT(handleResult(int, int, QString)));
  }
  </code></pre>
  
  <p>The problem this way is obviously that i can only send the SIGNAL to all connected threads. What i want the superThread to do is send arguments to only one of the threads. I don't know how i can handle the connection so that only one of the working threads receives it?</p>
  
  <p>Any help or architectural ideas much appreciated, thanks in advance. </p>