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. Qt and RPC
QtWS25 Last Chance

Qt and RPC

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 7.2k 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.
  • B Offline
    B Offline
    brianQt
    wrote on last edited by A Former User
    #1

    Hi Guys,

    Has anyone used RPC (Remote Procedural Calling) within their C++ Qt Application.

    I have been able to create a client/server application using the RpcGen which generates the c code client and server stubs. The client sends two numbers to the server which computes the sum of the two and returns the value. Now my goal is to take this minimalist approach and integrate it into a C++ Qt application. The problem I am having is that all of the tutorials for RPC shows the C application being executed via the command line passing in the args.. i.e. ./applicationName arg1 arg2.

    I would rather not use QProcess to execute the similar command. Instead be able to create the client within my Qt app and call the RPC procedure as well.

    Is this possible?

    Any help is appreciated, Thank you!

    kshegunovK 1 Reply Last reply
    0
    • B brianQt

      Hi Guys,

      Has anyone used RPC (Remote Procedural Calling) within their C++ Qt Application.

      I have been able to create a client/server application using the RpcGen which generates the c code client and server stubs. The client sends two numbers to the server which computes the sum of the two and returns the value. Now my goal is to take this minimalist approach and integrate it into a C++ Qt application. The problem I am having is that all of the tutorials for RPC shows the C application being executed via the command line passing in the args.. i.e. ./applicationName arg1 arg2.

      I would rather not use QProcess to execute the similar command. Instead be able to create the client within my Qt app and call the RPC procedure as well.

      Is this possible?

      Any help is appreciated, Thank you!

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      I have, over DBus. It's your best bet if you have it available (Linux) otherwise there are other possibilities but I'm not aware of any Qt-ready solution. I've read about remote QObject s' methods being called and it's apparently part of the Qt Mobility (I think available through the commercial license).

      Read and abide by the Qt Code of Conduct

      B 1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        Integrate ur rpc client code as library in qt application and call in qt program.

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

        B 1 Reply Last reply
        5
        • kshegunovK kshegunov

          I have, over DBus. It's your best bet if you have it available (Linux) otherwise there are other possibilities but I'm not aware of any Qt-ready solution. I've read about remote QObject s' methods being called and it's apparently part of the Qt Mobility (I think available through the commercial license).

          B Offline
          B Offline
          brianQt
          wrote on last edited by
          #4

          @kshegunov

          I am not sure if this solution would work for my application. Reason being the server code is already implemented on a separate system running RPC. I am mainly concerned with creating the Client. The Client will have to use the same .x file used by RpcGen to generate the Procedures. Can I use Qt D-Bus to communicate to the RPC Server using the same Procedures and ultimately get the same results as a RPC Client to RPC Server communication?

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

            Hi and welcome to devnet,

            From what you wrote, you already have this working using a small CLI. In that case, you can write a wrapper class that will use the code generated by RpcGen then use that class in your application.

            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
            2
            • dheerendraD dheerendra

              Integrate ur rpc client code as library in qt application and call in qt program.

              B Offline
              B Offline
              brianQt
              wrote on last edited by
              #6

              @dheerendra

              I had tried this approach but was receiving undefined reference errors to the Procedure created by RpcGen that had no definition. Using the .x file RpcGen would create the Client's .h and executable but no .c where the definition would reside. But the executable could be executed via the terminal ./appName arg1 arg2 with no errors. Therefore during compile/build time RpcGen handled the function definitions when generating the binaries. This is an area that I am unfamiliar with, it leaves me thinking that in order to use the Rpc procedures you must use the Rpc generated Client executables but this cannot be true?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                brianQt
                wrote on last edited by
                #7

                I have decided to go with the route of using QProcess to start a detached Client process and pass in the according parameters. I will update if changed

                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