Results 1 to 7 of 7

Thread: Problems with QThread and QTcpSocket

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Problems with QThread and QTcpSocket

    I never got an answer to my question, "How does sendHttpResponse() get called?" ..but anyway, I assume it gets called in consequence of the socket emitting a certain signal. Slots in a QThread object get executed in the thread where it lives in (that is the thread where it was created in), not in the thread which is being executed in QThread::run(). Check this thread.

    In my opinion the easiest solution would be to subclass QTcpSocket and write the functionality (which is currently in XRServerThread slots) into it. Then those slots would automatically get executed in correct thread.
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    cookiem (2nd November 2006)

  3. #2
    Join Date
    Jan 2006
    Location
    Dublin, Ireland
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Re: Problems with QThread and QTcpSocket

    Quote Originally Posted by jpn View Post
    I never got an answer to my question, "How does sendHttpResponse() get called?" ..but anyway, I assume it gets called in consequence of the socket emitting a certain signal. Slots in a QThread object get executed in the thread where it lives in (that is the thread where it was created in), not in the thread which is being executed in QThread::run(). Check this thread.

    In my opinion the easiest solution would be to subclass QTcpSocket and write the functionality (which is currently in XRServerThread slots) into it. Then those slots would automatically get executed in correct thread.
    Oh, i am so sorry, i missed that. You are right it's called from a slot. Thanks for the link and everything else My question was answered! Thanks again!

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.