Rename client.cc to the right extension.
[stockfish] / src / client.cpp
1 #include <iostream>
2 #include <memory>
3 #include <string>
4
5 #include <grpc++/grpc++.h>
6
7 #include "hashprobe.grpc.pb.h"
8
9 using grpc::Channel;
10 using grpc::ClientContext;
11 using grpc::Status;
12
13 int main(int argc, char** argv) {
14   std::shared_ptr<Channel> channel(grpc::CreateChannel(
15       "localhost:50051", grpc::InsecureChannelCredentials()));
16   std::unique_ptr<HashProbe::Stub> stub(HashProbe::NewStub(channel));
17
18   HashProbeRequest request;
19 //  request.set_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
20   request.set_fen(argv[1]);
21
22   HashProbeResponse response;
23   ClientContext context;
24   Status status = stub->Probe(&context, request, &response);
25
26   if (status.ok()) {
27     std::cout << response.DebugString();
28   } else {
29     std::cout << "RPC failed";
30   }
31
32   return 0;
33 }