update helloworld
This commit is contained in:
parent
d03233e66f
commit
27bd696d70
|
|
@ -90,22 +90,16 @@ class GreeterClient {
|
|||
}
|
||||
}
|
||||
|
||||
void Shutdown() { stub_.reset(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<Greeter::Stub> stub_;
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
grpc_init();
|
||||
|
||||
GreeterClient greeter(grpc::CreateChannel(
|
||||
"localhost:50051", grpc::InsecureCredentials(), ChannelArguments()));
|
||||
std::string user("world");
|
||||
std::string reply = greeter.SayHello(user);
|
||||
std::cout << "Greeter received: " << reply << std::endl;
|
||||
|
||||
greeter.Shutdown();
|
||||
|
||||
grpc_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,11 +131,8 @@ class ServerImpl final {
|
|||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
grpc_init();
|
||||
|
||||
ServerImpl server;
|
||||
server.Run();
|
||||
|
||||
grpc_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,15 +71,11 @@ class GreeterClient {
|
|||
}
|
||||
}
|
||||
|
||||
void Shutdown() { stub_.reset(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<Greeter::Stub> stub_;
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
grpc_init();
|
||||
|
||||
GreeterClient greeter(
|
||||
grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
|
||||
ChannelArguments()));
|
||||
|
|
@ -87,7 +83,5 @@ int main(int argc, char** argv) {
|
|||
std::string reply = greeter.SayHello(user);
|
||||
std::cout << "Greeter received: " << reply << std::endl;
|
||||
|
||||
greeter.Shutdown();
|
||||
|
||||
grpc_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,10 +73,7 @@ void RunServer() {
|
|||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
grpc_init();
|
||||
|
||||
RunServer();
|
||||
|
||||
grpc_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue