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. Way to send all types of events, from a client to a server

Way to send all types of events, from a client to a server

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 7 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.
  • D Offline
    D Offline
    danga96
    wrote on last edited by
    #1

    hello to the whole community Qt Forum,
    I have a question, I'm developing a client / server application, where the server has to do everything the client does, and vice versa, so I would like to know if there is a way to have the same events exchanged between the client and the server ;
    ie, if the client selecting a text and highlights it, the server also needs to do the same thing;
    I hope I was clear
    Thanks in advance :)

    Pablo J. RoginaP 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2
      1. You need to exchange the data between client & server in some format.
      2. After receiving the data, you need to construct the your custom QEvent object.
      3. Send the event object using QApplication::postEvent(..) metdhod.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      D 1 Reply Last reply
      4
      • D danga96

        hello to the whole community Qt Forum,
        I have a question, I'm developing a client / server application, where the server has to do everything the client does, and vice versa, so I would like to know if there is a way to have the same events exchanged between the client and the server ;
        ie, if the client selecting a text and highlights it, the server also needs to do the same thing;
        I hope I was clear
        Thanks in advance :)

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @danga96 said in Way to send all types of events, from a client to a server:

        so I would like to know if there is a way to have the same events exchanged between the client and the server ;

        It sounds kinda VNC-like application, so you may want to look at the RFB protocol...

        the server has to do everything the client does, and vice versa,

        Really? at the same time?

        So if client deletes the word "Hello" while server is highlighting that same word, what will happen?

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        D Kent-DorfmanK 2 Replies Last reply
        4
        • dheerendraD dheerendra
          1. You need to exchange the data between client & server in some format.
          2. After receiving the data, you need to construct the your custom QEvent object.
          3. Send the event object using QApplication::postEvent(..) metdhod.
          D Offline
          D Offline
          danga96
          wrote on last edited by
          #4

          @dheerendra Thank you for your reply...
          I would really like to know how to exchange this information;
          And where: in the main, or with a function connected to the manager of each event?

          1 Reply Last reply
          0
          • Pablo J. RoginaP Pablo J. Rogina

            @danga96 said in Way to send all types of events, from a client to a server:

            so I would like to know if there is a way to have the same events exchanged between the client and the server ;

            It sounds kinda VNC-like application, so you may want to look at the RFB protocol...

            the server has to do everything the client does, and vice versa,

            Really? at the same time?

            So if client deletes the word "Hello" while server is highlighting that same word, what will happen?

            D Offline
            D Offline
            danga96
            wrote on last edited by
            #5

            @Pablo-J.-Rogina
            thanks for giving me the standard, I'll read it to understand more;
            in practice it must do that, the purpose is to solve the problem of the CRDT, which I have already partially solved;
            I need a kind of echo system, which repeats the same operations both on the client and on the server, then conflict management will come later ...

            1 Reply Last reply
            0
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by
              #6

              Video game engines do this a lot. Even in single player games there can be the concept of client server. Usually it is client/server with server side authority with the client being corrected periodically. This prevents cheating. They usually feed events to both server and client. You may look at how video games engines do this. I know Torque 3D does this and I am guessing that UE4 and Unity probably have some method for this. I am sure there are a few video game related articles for this as well.

              C++ is a perfectly valid school of magic.

              1 Reply Last reply
              1
              • Pablo J. RoginaP Pablo J. Rogina

                @danga96 said in Way to send all types of events, from a client to a server:

                so I would like to know if there is a way to have the same events exchanged between the client and the server ;

                It sounds kinda VNC-like application, so you may want to look at the RFB protocol...

                the server has to do everything the client does, and vice versa,

                Really? at the same time?

                So if client deletes the word "Hello" while server is highlighting that same word, what will happen?

                Kent-DorfmanK Offline
                Kent-DorfmanK Offline
                Kent-Dorfman
                wrote on last edited by
                #7

                @Pablo-J.-Rogina said in Way to send all types of events, from a client to a server:

                It sounds kinda VNC-like application, so you may want to look at the RFB protocol...

                My thoughts, exactly. seems like he's just mirroring the interface across multiple machines.

                If you meet the AI on the road, kill it.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi,

                  Maybe the QtRemoteObjects module could be of interest.

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

                  D 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Hi,

                    Maybe the QtRemoteObjects module could be of interest.

                    D Offline
                    D Offline
                    danga96
                    wrote on last edited by
                    #9

                    @SGaist
                    oh ok, if you could tell me how I can capture all the events from a TextEdit class and send them to the server?

                    jsulmJ 1 Reply Last reply
                    0
                    • D danga96

                      @SGaist
                      oh ok, if you could tell me how I can capture all the events from a TextEdit class and send them to the server?

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

                      @danga96 You can implement an event filter: https://doc.qt.io/qt-5/qobject.html#installEventFilter

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

                      D 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @danga96 You can implement an event filter: https://doc.qt.io/qt-5/qobject.html#installEventFilter

                        D Offline
                        D Offline
                        danga96
                        wrote on last edited by
                        #11

                        @jsulm
                        ok event filter is it useful for capturing an event of any kind .. but how can I send this event to the server that has the same effect as on the client that generated it?

                        jsulmJ 1 Reply Last reply
                        0
                        • D danga96

                          @jsulm
                          ok event filter is it useful for capturing an event of any kind .. but how can I send this event to the server that has the same effect as on the client that generated it?

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

                          @danga96 said in Way to send all types of events, from a client to a server:

                          but how can I send this event to the server that has the same effect as on the client that generated it?

                          Well, you need to serialise the event into a message containing all relevant information, send the message, de-serialise it on the receiver side and then use https://doc.qt.io/qt-5/qcoreapplication.html#postEvent to post the same event on receiver side. How to serialise is up to you, you need to define a protocol.
                          Also take a look at @Kent-Dorfman suggestion.

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

                          1 Reply Last reply
                          1

                          • Login

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