i have part of my application that connects through other pc and send data using socket, as i add this to my main project the timeout of socket will block the gui, so my solution is put this part of program to a qthread..

however after i do this
Qt Code:
  1. thread = new Mythread();
  2. thread->start();
To copy to clipboard, switch view to plain text mode 
It will not wait for the socket to connect, the thread immediately exited so i add thread->wait()
Qt Code:
  1. thread = new Mythread();
  2. thread->start();
  3. thread->wait();//this solve the problem however..
To copy to clipboard, switch view to plain text mode 
by doing this it will block the GUI, and it is not the thread i want after all..

how to solve this?