00 proto 2024-08-31 / { C++ } { 3rdparty } { gRPC } proto syntax = "proto3";<!--more-->option java_package = "ex.grpc";package mathtest;// Defines the serviceservice MathTest { // Function invoked to send the request rpc sendRequest (MathRequest) returns (MathReply) {}}// The request message containing requested numbersmessage MathRequest { int32 a = 1; int32 b = 2;}// The response message containing responsemessage MathReply { int32 result = 1;}
01 Server 2024-08-31 / { C++ } { 3rdparty } { gRPC } Server 继承ServiceName::Service创建serviceImplementation 覆盖RPC方法,实现逻辑 Read On »
02 Client 2024-08-31 / { C++ } { 3rdparty } { gRPC } Client 通过grpc::CreateChannel传入IP string创建channel。 通过ServiceName::NewStub传入channel创建Stub Read On »
00 protobuf数据类型和C++数据类型对照表 2024-08-31 / { C++ } { 3rdparty } { protobuf } protobuf数据类型和C++数据类型对照表 Protobuf 类型 C++ 类型 备注 Read On »
02 数组repeated 2024-08-31 / { C++ } { 3rdparty } { protobuf } 数组repeated 在使用Protobuf中,可以使用repeated关键字作为限定修饰符来表示一个字段可以有多个值,即重复出现的字段。repeated关键字可以用于以下数据类型:基本数据类型、枚举类型和自定义消息类型。 Read On »