update helloworld

This commit is contained in:
Yang Gao 2015-05-08 11:42:08 -07:00
parent d03233e66f
commit 27bd696d70
4 changed files with 2 additions and 20 deletions

View File

@ -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;
}

View File

@ -131,11 +131,8 @@ class ServerImpl final {
};
int main(int argc, char** argv) {
grpc_init();
ServerImpl server;
server.Run();
grpc_shutdown();
return 0;
}

View File

@ -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;
}

View File

@ -73,10 +73,7 @@ void RunServer() {
}
int main(int argc, char** argv) {
grpc_init();
RunServer();
grpc_shutdown();
return 0;
}