Results 1 to 3 of 3

Thread: QTcpsocket and QDialog::exec()

  1. #1
    Join Date
    Jul 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question QTcpsocket and QDialog::exec()

    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?
    Last edited by timewolf; 19th August 2011 at 04:35.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QTcpsocket and QDialog::exec()

    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.

  3. #3
    Join Date
    Jul 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpsocket and QDialog::exec()

    Quote Originally Posted by Santosh Reddy View Post
    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.

Similar Threads

  1. Replies: 9
    Last Post: 25th March 2011, 22:22
  2. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 12:35
  3. QDialog problem with exec()
    By nomadscarecrow in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2010, 19:40
  4. exec() not blocking, derived QDialog, Qt 4.4.3
    By wdezell in forum Qt Programming
    Replies: 2
    Last Post: 4th August 2009, 19:56
  5. problem with show/exec of Qdialog
    By dudedude in forum Qt Programming
    Replies: 1
    Last Post: 23rd December 2008, 12:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.