Results 1 to 20 of 24

Thread: using socket descriptor to identify the clients connected to the Threded server

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: using socket descriptor to identify the clients connected to the Threded server

    To send a message to all clients, you'll need to keep a list of all connected clients.

    Why do you want to use threads? Are the clients/server synchronous (blocking) or asynchronous (non-blocking)?
    If you do not need synchronous connections, then do not use threads, just keep a list of the client sockets.

    Edit:
    Ohh... and do not add this line:
    connect(this->tcpSocket, SIGNAL(readyRead()), this, SLOT(ready1), Qt::UniqueConnection);
    in the run() function of a thread!
    Add it to the constructor of your thread, or a function that sets the socket for that thread.
    Last edited by tbscope; 13th May 2010 at 14:54. Reason: add more comments

Similar Threads

  1. Replies: 4
    Last Post: 30th November 2010, 21:09
  2. Replies: 7
    Last Post: 10th May 2010, 11:26
  3. Socket Descriptor
    By ManuMies in forum Qt Programming
    Replies: 1
    Last Post: 17th March 2009, 09:42
  4. remote port of a socket that hasn't connected yet
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2008, 17:24
  5. Staying connected to a MySQL server
    By fnmblot in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 10:39

Tags for this Thread

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.