Last active
August 11, 2018 10:07
-
-
Save pasdam/8293dec389e09391ac5b6d9eacd748d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <string> | |
#include <grpc++/grpc++.h> | |
#include "../core/GreeterClientCli.h" | |
#include "../../gen/greeting.grpc.pb.h" | |
using grpc::Channel; | |
using grpc::ClientContext; | |
using grpc::Status; | |
using example::GreetingRequest; | |
using example::GreetingReply; | |
int main(int argc, char** argv) { | |
// Instantiate the client. It requires a channel, out of which the actual RPCs | |
// are created. This channel models a connection to an endpoint (in this case, | |
// localhost at port 9001). We indicate that the channel isn't authenticated | |
// (use of InsecureChannelCredentials()). | |
GreeterClientCli greeter(grpc::CreateChannel("localhost:9001", grpc::InsecureChannelCredentials())); | |
std::cout << "Insert name: "; | |
std::string user; | |
std::getline(std::cin, user); | |
std::string reply = greeter.hello(user); | |
std::cout << "Greeter received: " << reply << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment