Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. increment variable of server class for each thread
Forum Updated to NodeBB v4.3 + New Features

increment variable of server class for each thread

Scheduled Pinned Locked Moved Unsolved Qt 6
2 Posts 2 Posters 356 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.
  • F Offline
    F Offline
    fari35
    wrote on last edited by
    #1

    In this example:

    https://www.bogotobogo.com/Qt/Qt5_QTcpServer_Multithreaded_Client_Server.php 
    

    I want to increment the value of count (which is a variable of server class) in each thread when the client connects to the server. How can I do that?

    jsulmJ 1 Reply Last reply
    0
    • F fari35

      In this example:

      https://www.bogotobogo.com/Qt/Qt5_QTcpServer_Multithreaded_Client_Server.php 
      

      I want to increment the value of count (which is a variable of server class) in each thread when the client connects to the server. How can I do that?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @fari35 said in increment variable of server class for each thread:

      How can I do that?

      Emit a signal in each thread as soon as a new client connects. Connect a slot to that signal and increment the count variable there.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

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