Using QUANTA's RPC classes


Introduction

       Remote Procedure Calls (RPC) enable a mechanism by which a caller might invoke the procedure on a remote machine, just as it was inthe local machine. The location of the procedure is transparent to the user.
QUANTA provides RPC mechanisms by which both one way (non blocking) and two way (blocking) calls can be done.

More about RPC?


QUANTA classes used

    QUANTAnet_rpcManager_c

                This class handles incoming RPC calls and is hence a 'Manager'. Use the init() method to initialize the manager and then you can use manage() or unmanage(). The manage() method lets you assign the procedure to be executed when a certain call is made. Finally the process() method is called in a while loop to process the RPC calls.

    QUANTAnet_rpcCaller_c

                Objects of this class can call the remote RPC manager. Use the init() method to initialize the callers. You can then use the call() method if a reply is required to the call or use the call1way() if a reply is not requested.

                The servertcp.cxx behaves like a RPC manager. It defines two subroutines doAndReplyCallback() and doOnceCallback() . The manage() method is used to say 'Run doAndReplyCallback() when the request "DO AND REPLY" is received' and 'Run doOnceCallback() when the request "DO ONCE" is received'. The client .cxx program uses the init() method to decide which subroutine is to be called. the init() is followed by a call() or a call1way()


Usage

 1. To run the server
      server

 2. To run a client
      client  <server-address>

Output

    When invoked, the first procedure prints
              "Doing and replying: RPC1 CLIENT CALLING"
     and sends a string "HELLO THERE" back to the client. So the client will display
              "Reply: HELLO THERE"
     The second procedure only prints without setting a reply
              "Doing once: RPC2 CLIENT CALLING".

for more information: Post your questions online on the Quanta forum page.