Results 1 to 11 of 11

Thread: QSocketNotifier: socket notifiers cannot be disabled from another thread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Aug 2006
    Location
    Switzerland
    Posts
    52
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QSocketNotifier: socket notifiers cannot be disabled from another thread

    Quote Originally Posted by dabiabilus View Post
    Why do I need an evet loop. tcpSocket can signal events such as "connected","disconnected" ,"errors". I do not need to call exec. I will try it.
    My mistake here, event loop isn't required. But I'm not sure if you are aware that in such case your sendMessage slot isn't executed in client thread. There are three threads here: main thread, client thread and sender thread. Socket reading is done in client thread, that's obvious. But sendMessage slot is executed either in main thread (if you make queued connection between Sender and Client) or in sender thread (if you make direct connection between Sender and Client).
    Quote Originally Posted by dabiabilus View Post
    Problem occurs when Client receives "sendMessage" signal of the sender, and tries to write socket.
    I wrote a program like yours (two threads, Client and Sender) and I don't have that problem. Of course "QObject: Cannot create children for a parent that is in a different thread." is still there, but I wasn't able to reproduce "QSocketNotifier: socket notifiers cannot be disabled from another thread"
    Last edited by danadam; 19th March 2007 at 21:38.
    The Wheel weaves as the Wheel wills.

Similar Threads

  1. question about socket and threads?
    By oob2 in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2007, 11:42
  2. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  3. How to write on a socket in another thread?
    By Valheru in forum Qt Programming
    Replies: 7
    Last Post: 12th October 2006, 10:52

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.