Results 1 to 3 of 3

Thread: Multiple threads with one QTcpSocket

  1. #1
    Join Date
    Aug 2009
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Multiple threads with one QTcpSocket

    Hi,

    From what I gather from the docs, one cannot set the same socket descriptor across multiple QTcpSockets in different threads.

    Is there a way around this if one just wants to have one thread read while the other writes?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple threads with one QTcpSocket

    Why would you want that (and no, there is no way to do it the Qt way)?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple threads with one QTcpSocket

    Thanks for the reply. I have a write thread that needs to block on a message queue, processes the queue data, then write it out to the socket. I have another thread who's responsibilities is to read data from the socket and generate events. I thought it would just be simplier to have the two threads doing their own thing. I guess I will have to just have one thread which then waits for signals on socket data received and an insertion into the queue.

Similar Threads

  1. Threads in Qt
    By freekill in forum Qt Programming
    Replies: 4
    Last Post: 11th November 2009, 18:49
  2. Phonon on multiple threads
    By Savignon in forum Qt Programming
    Replies: 5
    Last Post: 6th March 2009, 22:17
  3. Waiting for multiple threads
    By Bebee in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2008, 17:21
  4. Replies: 0
    Last Post: 21st December 2006, 11:48
  5. Organizing multiple threads
    By vratojr in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2006, 09:53

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.