Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTcpServer multiple clients without threads
Forum Updated to NodeBB v4.3 + New Features

QTcpServer multiple clients without threads

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SpartaWHY117
    wrote on 20 Sept 2016, 18:56 last edited by A Former User
    #1

    I want to write a sever that can handle multiple clients and without using threads . I have already read some website about this topic . The main way is use a QList(or other STL)and a QSignalMapper,so when comes the data ,the readyread function how to get which client send this data ? And how to property handle one clinet disconnected (As for the Qlist remove control )?

    K 1 Reply Last reply 21 Sept 2016, 11:17
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Sept 2016, 20:23 last edited by
      #2

      Hi,

      On way is to used the sender method in your slot. You can take the Fortune Server Example as a starting point and rather than closing the connection at the end of the function, store it in your container.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S SpartaWHY117
        20 Sept 2016, 18:56

        I want to write a sever that can handle multiple clients and without using threads . I have already read some website about this topic . The main way is use a QList(or other STL)and a QSignalMapper,so when comes the data ,the readyread function how to get which client send this data ? And how to property handle one clinet disconnected (As for the Qlist remove control )?

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 21 Sept 2016, 11:17 last edited by kshegunov
        #3

        Look at this as well. It's a threaded TCP server, but you can remove the QThread related code in the server object and you'd be good to go.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0

        1/3

        20 Sept 2016, 18:56

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved