This project is a simple demonstration of remote procedure call (RPC) communication using a client-server architecture. In this example, we use a spaceship and its navigation system to illustrate how RPC can be used in a real-world application.
a powerful technology for creating distributed client/server programs. You can use RPC in all client/server applications based on Windows operating systems. It can also be used to create client and server programs for heterogeneous network environments that include such operating systems as Unix and Apple.
IDL is a descriptive language to describe interfaces being implemented by objects.
files contains the building blocks of our spaceship.
It contains the spaceship's interfaces such as engine, flight status system and their functions.
In the RPC context, ACF files are used to configure the endpoints of remote services or components that can be accessed by RPC clients. They contain information such as the network address of the server, port number, and the server's interface.
COM and RPC are technologies used in software development for distributed systems. COM is used to create reusable software components that can communicate with each other using the COM interface. RPC is used to invoke a procedure or function on a remote machine. While both can be used for distributed systems, COM is focused on component-based software development, and RPC is focused on remote procedure invocation.
Clone this repository to your local machine
git clone https://github.com/0xMegaByte/RPC-Explained
cd RPC-Explained
cd IDL
- Open
RPC-Explained.idlin an editor of your choice. - Using
Developer Command Prompt for VS 2022.exedo the following:- For every UUID in the idl file, generate your own UUID using
uuidgentool to avoid UUID collision - Replace the old UUIDs with the newly generated UUIDs.
- After all the UUIDs replaced, save and compile the IDL file with the ACF file
midl.exe /acf RPC-Explained.acf RPC-Explained.idl- Upon successful compilation, a total of 3 files are generated:\
- RPC-Explained.h - Contains the declarations of the interfaces, structures, and data types defined in the IDL file.
- RPC-Explained_c.c - Client stub file
- RPC_Explained_s.c - Server stub file
- For every UUID in the idl file, generate your own UUID using
- Open
RPC-Explained.slnin Visual Studio 2022 - Build the solution
NOTE: Please ensure that both projects have their C++ version set to ISO C++20 Standard (/std:c++20) and platform toolset to v143.
The spaceship in this project has a navigation system that requires a destination to be set before it can navigate.
Users can control the spaceship using the client component of the project.
The following commands are available:
implicit: Use implicit rpc communication method with the serverexplicit: Use excplicit rpc communication method with the serverterminate: Terminates the connection with the server
set destination: Set the spaceship's destination. This command requires a parameter specifying the destination.get destinations: Get a list of available destinations.get location: Get the current location of the spaceship.
The default location of the spaceship is"0.00, 0.00", and it can only change if a destination has been set and thenavigatecommand has been issued.navigate: Move the spaceship to a random location. This command can only be used if a destination has been set.
Disclaimer: There isn't an actual system for calculating a path to the selected destination. The spaceship location changes randomly.stop: Stop the spaceship. This command can be used at any time to halt the spaceship's movement.help: display help
To begin, you must select either the explicit or implicit binding protocol.

During startup, the server has already registered both binding protocols.

If you would like to contribute to this project, please feel free to submit a pull request. I welcome any suggestions or improvements that you may have.
This project was created by Matan Shitrit @0xMegaByte.
This project is licensed under the GPL-3.0. See the LICENSE file for more information.
Introduction to RPC - Part 1 by Anders Dalvander
MSDN - Remote Procedure Call (RPC)