Skip to content
Snippets Groups Projects
Commit 44e98225 authored by Yang Gao's avatar Yang Gao
Browse files

Change code and text in text too

parent 50bc9a77
No related branches found
No related tags found
No related merge requests found
...@@ -220,9 +220,7 @@ void RunServer(const std::string& db_path) { ...@@ -220,9 +220,7 @@ void RunServer(const std::string& db_path) {
builder.RegisterService(&service); builder.RegisterService(&service);
std::unique_ptr<Server> server(builder.BuildAndStart()); std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl; std::cout << "Server listening on " << server_address << std::endl;
while (true) { server->Wait();
std::this_thread::sleep_for(std::chrono::seconds(5));
}
} }
``` ```
As you can see, we build and start our server using a `ServerBuilder`. To do this, we: As you can see, we build and start our server using a `ServerBuilder`. To do this, we:
...@@ -232,8 +230,7 @@ As you can see, we build and start our server using a `ServerBuilder`. To do thi ...@@ -232,8 +230,7 @@ As you can see, we build and start our server using a `ServerBuilder`. To do thi
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 `AddPort()` method.
4. Register our service implementation with the builder. 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 `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.
_[is there no equivalent of the Stubby4 wait() method, ie do you have to do the while(true) loop to keep the server running?]_
<a name="client"></a> <a name="client"></a>
## Creating the client ## Creating the client
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment