#include #include #include #include "echo.grpc.pb.h" using namespace std; using namespace echo; using grpc::Channel; using grpc::ClientContext; using grpc::Status; class EchoClient { public: EchoClient(shared_ptr chan) : stub_(Echo::NewStub(chan)) {} Status DoEcho(const string& msg){ EchoRequest req; req.set_message(msg); EchoRequest resp; ClientContext ctx; return stub_->DoEcho(&ctx, req, &resp); } private: unique_ptr stub_; }; class AddClient { public: AddClient(shared_ptr chan) : stub_(Add::NewStub(chan)) {} AddResponse DoAdd(const uint32_t x, const uint32_t y){ AddRequest msg; msg.set_addx(x); msg.set_addy(y); AddResponse resp; ClientContext ctx; stub_->DoAdd(&ctx, msg, &resp); return resp; } private: unique_ptr stub_; }; int main(){ /* EchoClient client(grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials())); string msg("hi"); for(int i = 0; i < 100000; i++){ Status status = client.DoEcho(msg); if(!status.ok()){ cout<<"Error: "<