Results 1 to 20 of 21

Thread: Thread+send event

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Thread+send event

    It means that you don't get the disconnected() signal. If you would, then the quit slot for the thread will get called, causing exec() to exit.

    The default delay for waitForDisconnected is 30 seconds.
    Try giving it a smaller delay, like 5 seconds ( pass 5000 to waitForDisconnected ).

    If you still don't get the disconnected signal, then it means that there is still data pending to be read. But giving it an explicit timeout, it should force a disconnected() signal.

    Regards

  2. #2
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Thread+send event

    hmmm...

    For made comments on a line
    Qt Code:
    1. .....
    2. .....
    3. .....
    4. this->disconnectFromHost();
    5. // if(this->state() == QAbstractSocket::ConnectedState) - !!!
    6. this->waitForDisconnected(5000);
    7. }
    To copy to clipboard, switch view to plain text mode 

    and here that has received in messages

    QAbstractSocket::waitForDisconnected() is not allowed in UnconnectedState

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Thread+send event

    I think the disconnected signal gets messed up.
    Move the connect statement from run right after you create the connection.
    Just before you call setSocketDescriptor.

    Regards.

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  2. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10
  3. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  4. Replies: 11
    Last Post: 7th July 2006, 13:09
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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
  •  
Qt is a trademark of The Qt Company.