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.5k 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 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 )?

    kshegunovK 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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

        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 )?

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on 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

        • Login

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