Craig Tiller 0a6ed67c66 Merge pull request #55 from yang-g/channel 11 ani în urmă
..
helloworld 0a6ed67c66 Merge pull request #55 from yang-g/channel 11 ani în urmă
route_guide 50bc9a77f8 Change to server.Wait() api. 11 ani în urmă
README.md 84c263fd72 Add port info. 11 ani în urmă
cpptutorial.md 9a2ff4f376 Add build and run section 11 ani în urmă

README.md

#gRPC in 3 minutes (C++)

Installation

To install gRPC on your system, follow the instructions here: https://github.com/grpc/grpc/blob/master/INSTALL.

Hello C++ gRPC!

Here's how to build and run the C++ implementation of the Hello World example used in Getting started.

The example code for this and our other examples lives in the grpc-common GitHub repository. Clone this repository to your local machine by running the following command:

$ git clone https://github.com/google/grpc-common.git

Change your current directory to grpc-common/cpp/helloworld

$ cd grpc-common/cpp/helloworld/

Generating gRPC code

To generate the client and server side interfaces:

$ make helloworld.pb.cc

Which internally invokes the proto-compiler as:

$ protoc -I ../../protos/ --cpp_out=. --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin ../../protos/helloworld.proto

Client and server implementations

The client implementation is at greeter_client.cc.

The server implementation is at greeter_server.cc.

Try it!

Build client and server:

$ make

Run the server, which will listen on port 50051:

$ ./greeter_server

Run the client (in a different terminal):

$ ./greeter_client

If things go smoothly, you will see the "Greeter received: Hello world" in the client side output.

Tutorial

You can find a more detailed tutorial in gRPC Basics: C++