Hi everybody!

I'm programming an application with QThreads and QUdp/Tcp sockets.

My main thread or GUI creates a secondary thread1 and this one creates two more threads, thread2 and thread3, thread2 contains a QTcpServer and thread3 a QUdpSocket. The sockets are connected to different ports. When a message comes on the QTcpServer port, the readyread signal is emitted but not when a message comes for the QUdpSocket, although I see the messages in wireshark.

The point is: If I only call thread3 from the main thread it receives the readyread signal when a message comes.

In both thread2 and thread3 the signals are connected in the run function like this:

Qt Code:
  1. // thread 2
  2. run(){
  3. connect(tcpServer, SIGNAL(newConnection()),SLOT(acceptConnection()), Qt::DirectConnection)
  4. exec()
  5. }
  6. // accept function in thread2
  7. acceptConnection(){
  8. connect(tcpClient, SIGNAL(readyRead()),SLOT(startRead()), Qt::DirectConnection);
  9. }
  10.  
  11. // thread 3
  12. run{
  13. connect(traceMessage, SIGNAL(readyRead()), SLOT(readPendingDatagrams()), Qt::DirectConnection);
  14. exec()
  15. }
To copy to clipboard, switch view to plain text mode 

Is there a problem for thread1 to emit two signals readyread for thread2 and thread3?

has anyone any ideas?

Thank you very much!