Skip to content

Lynette7/Assignment_RPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Distributed programs that use the RPC paradigm

Programs

  • registration - a client server program which implements a class registration platform. The program should allow the user to register themselves by entering their details which include the student registration number and names.
  • calculator - a client server program which implements a simple calculator. The calculator can perform the following operations (+, -, *, /) chosen by the user on any two integers supplied by the user.
  1. Install gRPC and Protobuf on your Linux system:

Step 1: Install the necessary dependencies:

sudo apt-get update
sudo apt-get install build-essential autoconf libtool pkg-config

Step 2: Install gRPC and Protobuf using apt:

sudo apt-get install libgrpc++-dev protobuf-compiler-grpc

Step 3: Install gRPC C++ Plugin:

sudo apt-get install grpc-compiler
  1. Compile the Protobuf Files
  • In the same directory as your program, run the following command to compile the Protobuf files:
 protoc --cpp_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` filename.idl.proto

Replace 'filename' with the actual name of your file. This command generates the necessary C++ files (filename.idl.pb.h and filename.idl.grpc.pb.h) based on the Protobuf definition (filename.idl.proto).

  1. Build the server
  • Use a C++ compiler to build the server code and link against the required gRPC libraries. Assuming you have g++ installed, you can use the following command:
g++ -std=c++11 -o server server.cpp filename.idl.grpc.pb.cc filename.idl.pb.cc -lgrpc++ -lgrpc -lprotobuf -pthread
  1. Build the client
g++ -std=c++11 -o client client.cpp filename.idl.grpc.pb.cc filename.idl.pb.cc -lgrpc++ -lgrpc -lprotobuf -pthread
  1. Run the server
  • Execute the server program in one terminal window:
./server
  1. Run the client
  • In another terminal window, execute the client program:
./client

About

Distributed programs that use the RPC paradigm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages