From 2afb270dfe4e07b3ed8dce40f13060abffe848ac Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 23 Mar 2015 23:44:31 +0100 Subject: [PATCH] API change - fixing old code and doc. --- cpp/cpptutorial.md | 4 ++-- cpp/helloworld/greeter_server.cc | 2 +- cpp/route_guide/route_guide_server.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/cpptutorial.md b/cpp/cpptutorial.md index ec4584fc9c8..ebad7b183b7 100644 --- a/cpp/cpptutorial.md +++ b/cpp/cpptutorial.md @@ -214,7 +214,7 @@ void RunServer(const std::string& db_path) { RouteGuideImpl service(db_path); ServerBuilder builder; - builder.AddPort(server_address, grpc::InsecureServerCredentials()); + builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); builder.RegisterService(&service); std::unique_ptr server(builder.BuildAndStart()); std::cout << "Server listening on " << server_address << std::endl; @@ -225,7 +225,7 @@ As you can see, we build and start our server using a `ServerBuilder`. To do thi 1. Create an instance of our service implementation class `RouteGuideImpl`. 2. Create an instance of the factory `ServerBuilder` class. -3. Specify the address and port we want to use to listen for client requests using the builder's `AddPort()` method. +3. Specify the address and port we want to use to listen for client requests using the builder's `AddListeningPort()` method. 4. Register our service implementation with the builder. 5. Call `BuildAndStart()` on the builder to create and start an RPC server for our service. 5. Call `Wait()` on the server to do a blocking wait until process is killed or `Shutdown()` is called. diff --git a/cpp/helloworld/greeter_server.cc b/cpp/helloworld/greeter_server.cc index 7885a160a05..e7f355f4cef 100644 --- a/cpp/helloworld/greeter_server.cc +++ b/cpp/helloworld/greeter_server.cc @@ -65,7 +65,7 @@ void RunServer() { GreeterServiceImpl service; ServerBuilder builder; - builder.AddPort(server_address, grpc::InsecureServerCredentials()); + builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); builder.RegisterService(&service); std::unique_ptr server(builder.BuildAndStart()); std::cout << "Server listening on " << server_address << std::endl; diff --git a/cpp/route_guide/route_guide_server.cc b/cpp/route_guide/route_guide_server.cc index c6dbce5712a..edef0484197 100644 --- a/cpp/route_guide/route_guide_server.cc +++ b/cpp/route_guide/route_guide_server.cc @@ -187,7 +187,7 @@ void RunServer(const std::string& db_path) { RouteGuideImpl service(db_path); ServerBuilder builder; - builder.AddPort(server_address, grpc::InsecureServerCredentials()); + builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); builder.RegisterService(&service); std::unique_ptr server(builder.BuildAndStart()); std::cout << "Server listening on " << server_address << std::endl;