2016-07-14-grpc-streaming-example

layouttitlesubtitledateauthortags
post
hellostreamingworld 示例实现
github 的 markdown 好麻烦。。。
2016-07-15
cj
gRPC c++

文件夹examples/protos 内有个 hellostreamingworld.proto,但是 examples/cpp 内没有对应的示例代码。我参考 route_guide 和 helloworld 两个示例,写出了这份程序。

  1. 生成cc 文件

    protoc --cpp_out=. hellostreamingworld.proto 
    protoc --grpc_out=. --plugin=protoc-gen-grpc="path/to/cpp-plugin.exe" hellostreamingworld.proto
  2. 建立 grpc_streaming_greeter_client 工程

    添加第1步生成的4个文件、设置工程属性、添加引用库路径、包含库等设置步骤已在Windows 下 gRPC 安装小记一文写出,不再赘述。 查看代码

  3. 建立 grpc_streaming_greeter_server 工程,项目设置同上。

    查看代码

  4. 测试

    先后运行 server 与 client 程序,client 输出3行 "Greeter received: hello world",验证无误。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值