Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrofsevilla authored Jun 2, 2023
1 parent 5f60e7e commit 7bec0ee
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ message SimpleReply {
```c++
#include <GrpcServer.hpp>
#include <iostream>

#include "SimpleService.grpc.pb.h"
//...

// ...

GrpcServer server;
server.addListeningPort("127.0.0.1:8800", grpc::InsecureServerCredentials());
SimpleService::AsyncService service;
Expand All @@ -42,15 +45,19 @@ server.requestCallFromService<SimpleService::AsyncService, SimpleRequest,
std::cout << call.message() << std::endl;
});
server.startHandlingCalls();
//...

// ...
```
### Client
```c++
#include <GrpcClient.hpp>
#include <iostream>
#include <thread>
#include "SimpleService.grpc.pb.h"
//...
// ...
GrpcClient<SimpleService> client{grpc::CreateChannel(
"127.0.0.1:8800", grpc::InsecureChannelCredentials())};
auto thread =
Expand All @@ -64,5 +71,6 @@ while (true) {
call, &SimpleService::Stub::PrepareAsyncSendRequest,
[](const auto& reply) { std::cout << reply.message() << std::endl; });
}
//...
// ...
```

0 comments on commit 7bec0ee

Please sign in to comment.