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. How QT handle the concurrency network request?

How QT handle the concurrency network request?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 760 Views
  • 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
    #1

    the requirement :

    one sever as matser node ,many client as slave node .

    slave nodes collect some real-time information of themselves ,once the network set ready .slave node push the information to matser node on their own periodically(for example :node 1 period is 10 seconds ,node 2 is another value) .

    My question:

    1. can I use the udpsocket to achieve this goal ?
    2. if use tcpsocket,should I need mutil-thread to handle this problem ?assume there is 100 node ,that is to say i need use 100 thread ?
      3.every connection need a timer to control it ?

    so what are usual ways that experienced developers to handle this situation ? or maybe i should use some other third library as boost asio ?I have heard the method NIO channel in JAVA, so i want to find the same method in QT,does it exist ?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      If you can live with the flaws of UDP (losing some data every once in a while) then you can use it otherwise threads on the server, 1 for each client is the way to go

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SpartaWHY117
        wrote on last edited by
        #3

        but i don;t think 100 threads in one process is a good ideal

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          It's not like having 100 working threads crunching numbers and fighting for CPU time, most of them will be idle unless there is data to be transmitted. The firefox instance I'm using to type this message, for example, is running 100 threads

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          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