Hi,
at the moment I try to program a TcpServer and i would like to thread the socket.
So my code looks like this:


Qt Code:
  1. void Server::incomingConnection(int socketId)
  2. {
  3. socket = new ClientSocket;
  4. socket->setSocketDescriptor(socketId);
  5.  
  6. QThread *socketThread = new QThread;
  7.  
  8. socket->moveToThread(socketThread);
  9. socketThread->start();
  10.  
  11. }
To copy to clipboard, switch view to plain text mode 

With this code I expected two threads. One main thread and another for my ClientSocket. But using

Qt Code:
  1. qDebug() << QThread::currentThreadId;
To copy to clipboard, switch view to plain text mode 

returns always the same ThreadID (in Server and ClientSocket class).

What am I doing wrong? Or am I using currentThreadId wrong?
Thanks for your help.

Bernie