10 #include <thrift/protocol/TBinaryProtocol.h>
11 #include <thrift/transport/THttpClient.h>
12 #include <boost/shared_ptr.hpp>
13 #include <IpService.h>
15 int main(
int argc,
char** argv) {
16 using namespace apache::thrift::protocol;
17 using namespace apache::thrift::transport;
18 boost::shared_ptr<THttpClient> transport(
new THttpClient(
"localhost", 8080,
"/"));
19 boost::shared_ptr<TBinaryProtocol> protocol(
new TBinaryProtocol(transport));
20 IpServiceClient client(protocol);
25 std::cout <<
"Sending request" << std::endl;
26 int32_t ip = 123456789;
29 client.lookup(r, ip, ipv6);
31 for (
auto& kv : r.key_values) {
32 std::cout <<
"key.id=" << kv.key.id <<
" key.name=" << kv.key.name << std::endl;
33 for (
auto& val : kv.values) {
34 std::cout <<
" val.id=" << val.id <<
" val.name=" << val.name << std::endl;
39 }
catch (TTransportException& e) {
40 std::cerr << e.what() << std::endl;
int main(int argc, char **argv)