PDA

View Full Version : QTcpsocket and QDialog::exec()



timewolf
19th August 2011, 03:30
Update: I am wrong. The QDialog::exec() doesn't block the socket communications...just one of the model dialogs behaviors weirdly.

--------------------------------------------------------------------------------------------
Hi, I saw several posts from the web, saying that it's not necessary to put QTcpsocket in a separate thread. But I met problems when working on a GUI program.

Here's the background: I have a GUI server program and a GUI client program. The server sometimes pops up a model dialog and waits for user's input.

The problem is: as long as the model dialog is visible, the QTcpServer doesn't receives any data from the client socket. Seems QDialog::exec() blocks the procedure. There're many model dialogs in my program, so, should I put QTcpServer and QTcpSocket communication in non-UI threads?

Santosh Reddy
19th August 2011, 04:47
If server pop's up model dialog in side a slot connected to readyRead() signal, then you will not be able to receive any further readyRead() signals, may be this is the reason for no reception.

timewolf
25th August 2011, 08:27
If server pop's up model dialog in side a slot connected to readyRead() signal, then you will not be able to receive any further readyRead() signals, may be this is the reason for no reception.

Exactly that problem! Santosh, thank you for pointing it out.