Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to transporting signals through the network to make a daemon-gui program pair?



  • Hi All,

    I would like to build software that is daemon-gui. The daemon runs all the business logic. The gui is the user interface. Both programs connect true a network socket.

    I would like to know if there's a standard way to send and receive signals via the network socket between daemon and gui.

    As a trial project, I would like to rebuild this program as a client-server program pair: https://github.com/cdwijs/Tenma_data_logger.git
    This program receives measurements from 2 multimeters, and saves them into a file. The program has the following objects (from top to bottom):
    main (RS232DATALOGGER)
    TENMA data interpreter (2 instances)
    RS232 (With a button "Connect")
    RS232Settings

    Now I'm thinking about making the following protocol to remote control this application. For instance, if I want to press the "connect" button on the top serial port of the GUI, It would send the following string to the daemon:
    "Main.temna#0.rs232.connect=true"
    The socketconnection receives it, and sends this string to the main program:
    "temna#0.rs232.connect=true"
    The main program sends the following string to the first instance of temna:
    "rs232.connect=true"
    Temna then sends this string to Rs232:
    "connect=true"
    Rs232 the opens the serial port

    If the daemon then receives a message from the serial port, the green LED in the GUI should flash, so it would send the following string:
    "Main.temna#0.rs232.RxLed=true"
    The socketconnection receives it, and sends this string to the main program:
    "temna#0.rs232.RxLed=true"
    The main program sends the following string to the first instance of temna:
    "rs232.RxLed=true"
    Temna then sends this string to Rs232:
    "RxLed=true"
    And Rs232 then turns on the RX LED (and starts a timer to turn it off again)

    The above approach has some problems:

    1. It's string based, so it takes a lot of processing power.
    2. The strings are long, so for large programs this can generate a lot of network traffic
    3. There's no guarantee about the datatypes in the signals.
    4. The GUI and the sever have to agree on the string used to communicate.

    Is there a better mechanism for transporting signals through the network?

    Cheers,
    Cedric

    [Edit aha_1980: Fixed typo in title]


  • Lifetime Qt Champion

    Hi
    You could have a look at
    https://doc.qt.io/qt-5.11/qtremoteobjects-index.html
    Not sure it fits 100% for your use case but the remote part of your description does sound like
    RPC-ish.


Log in to reply