当前位置: 首页 > news >正文

做兼职推荐网站哈尔滨网站建设工作

做兼职推荐网站,哈尔滨网站建设工作,如何维护公司网站,建设局副局长简介 基于之前的文章所说#xff0c; Qt6.7之后才开始支持客户端、服务端、及双向流#xff0c;恰好电脑需要重装#xff0c;看到Qt6.8版本就直接安装了#xff0c;内容也是使用Qt6.8的版本进行编译的 客户端实现步骤 1. 安装Qt6.8, 包含GRPC功能模块 Qt 6.8安装目录下包…简介 基于之前的文章所说 Qt6.7之后才开始支持客户端、服务端、及双向流恰好电脑需要重装看到Qt6.8版本就直接安装了内容也是使用Qt6.8的版本进行编译的 客户端实现步骤 1. 安装Qt6.8, 包含GRPC功能模块 Qt 6.8安装目录下包含这两个组件就可以将.proto生成Qt库支持了2. 基于上一篇的示例生成Qt支持 基于 Qt6.8 GRPC功能使用(1)标准GRPC C exmple编译环境搭建 新建一个Qt grpc客户端应用, 将 helloworld.proto 拷贝到该应用中.pro加上grpc支持 .pro grpc proto文件 .proto文件内容 来自xxx\grpc-1.55.0\examples\protos\helloworld.proto syntax proto3;option java_multiple_files true; option java_package io.grpc.examples.helloworld; option java_outer_classname HelloWorldProto; option objc_class_prefix HLW;package helloworld;// The greeting service definition. service Greeter {// Sends a greetingrpc SayHello (HelloRequest) returns (HelloReply) {}rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {} }// The request message containing the users name. message HelloRequest {string name 1; }// The response message containing the greetings message HelloReply {string message 1; }生成 Proto buffer的Qt支持 D:\Softwares\Paths\msys64\mingw64\bin\protoc.exe --pluginprotoc-gen-qtprotobufD:\Softwares\IDEs\Qt\6.8.0\mingw_64\bin\qtprotobufgen.exe -I E:/Workspace/Qt/greeter_client_qt/grpc --qtprotobuf_out“E:/Workspace/Qt/greeter_client_qt/grpc” “E:/Workspace/Qt/greeter_client_qt/grpc/helloworld.proto” 生成 GRPC 的Qt支持 D:\Softwares\Paths\msys64\mingw64\bin\protoc.exe --pluginprotoc-gen-qtgrpcD:\Softwares\IDEs\Qt\6.8.0\mingw_64\bin\qtgrpcgen.exe -I E:/Workspace/Qt/greeter_client_qt/grpc --qtgrpc_out“E:/Workspace/Qt/greeter_client_qt/grpc” “E:/Workspace/Qt/greeter_client_qt/grpc/helloworld.proto” 3. 增加client代码 #include QCoreApplication #include QGrpcChannelOptions #include QGrpcServerStream #include helloworld_client.grpc.qpb.h #include QGrpcHttp2Channel #include QDebugint main(int argc, char *argv[]) {QCoreApplication a(argc, argv);helloworld::Greeter::Client client;QAbstractSocket::connect(client, QAbstractGrpcClient::errorOccurred, [](const QGrpcStatus status){qDebug().noquote() errorOccurred : status.code() status.message();});QAbstractSocket::connect(client, QAbstractGrpcClient::channelChanged, [](){qDebug().noquote() channelChanged!;});QUrl url (http://localhost:50051);QGrpcChannelOptions channelOptions(url);std::shared_ptrQAbstractGrpcChannel channel std::make_sharedQGrpcHttp2Channel(channelOptions);client.attachChannel(channel);helloworld::HelloRequest req;req.setName(GrayHsu);std::shared_ptrQGrpcCallReply grpcReply client.SayHello(req);QAbstractSocket::connect(grpcReply.get(), QGrpcCallReply::errorOccurred, [](const QGrpcStatus status){qDebug().noquote() sayHello errorOccurred : status.code() status.message();});QAbstractSocket::connect(grpcReply.get(), QGrpcCallReply::finished, [](){helloworld::HelloReply rep;grpcReply-read(rep);qDebug().noquote() finished: rep.message();});return a.exec(); } 执行结果: Server 没开 Server开了 4. Qt库简单说明 QGrpcCallReply用于接收返回信息, 提供了两个信号, 用于监控是否出错及是否结束(流时则为关闭) std::shared_ptr grpcReply client.SayHello(req); Note .proto 文件生成protobuffer和支持grpc语言文件支持指令 例如: 如下指令直接生成grpc_out的grpc支持-cpp_out输出protobuffer支持D:\Softwares\Paths\msys64\mingw64\bin\protoc.exe --grpc_out E:/test/grpc-1.55.0/examples/cpp/helloworld/cmake/build --cpp_out E:/test/grpc-1.55.0/examples/cpp/helloworld/cmake/build -I E:/test/grpc-1.55.0/examples/protos --pluginprotoc-gen-grpcD:/Softwares/Paths/msys64/mingw64/bin/grpc_cpp_plugin.exe E:/test/grpc-1.55.0/examples/protos/helloworld.proto
http://www.pierceye.com/news/256651/

相关文章:

  • 山西网站建设多少钱电商网站建设需要
  • 海西电子商务网站建设wordpress 主题宽度
  • 网站建设首选公司wordpress需要mysql
  • 织梦 旅游网站模板深圳公司招牌制作
  • PHP网站开发如何建立vipwordpress页面伪静态
  • 主题公园旅游景区网站建设网站后台图片模板
  • 慈溪网站建设慈溪WordPress点击文章显示404
  • 网站建设与seo网站开发项目总结范文
  • 做竞彩网站代理犯法么建站公司 网站
  • 浙江建设证书查询seo服务公司深圳
  • 长沙协会网站设计专业服务医疗信息化软件公司排名
  • 北京网站制作一般多少钱黑色网站欣赏
  • 广州建设工程造价管理站wordpress获取文章title
  • 免费购物网站源码网站开发的论文引言
  • 商城网站开发需要哪些人员本机建的网站打开却很慢
  • 网站建设哪专业学会python做网站
  • vs怎么添加图片做网站地方门户网站管理系统
  • 三亚做网站的公司科技网站推荐
  • 电商网站运维怎么做自己做网站创业
  • seo有哪些网站集团公司网站 案例
  • 传媒大学附近网站建设公司天津市工程建设公众信息网官网
  • 关于网站建设与维护的参考文献家装设计费用多少钱一平方
  • 网站建设与管理专业概述网站建设报价费用是多少
  • asp医院网站源码破解版北京企业做网站报价
  • 个人做电商网站赚钱吗门业网站模板
  • 企业产品微网站收费吗wordpress移服务器改域名
  • 原创文章网站网站建设团队介绍
  • WordPress建站详细过程安康建设网站
  • 仿视频网站开发wordpress下载文件
  • 专业的个人网站建设哪家建筑施工企业专职安全生产管理员