#include #include #include #include #include "gen-cpp/myService.h" using namespace std; using namespace boost; using namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; int main(int argc, char** argv) { int port = 9090; shared_ptr socket(new TSocket("localhost", port)); shared_ptr transport(new TBufferedTransport(socket)); shared_ptr protocol(new TBinaryProtocol(transport)); myServiceClient client(protocol); try { transport->open(); while (true) { string answ; client.answer(answ, "How are you?"); cout << "Server answers: " << answ << endl; sleep(1); } transport->close(); } catch (TException& exc) { cout << "Exception: " << exc.what() << endl; } return 0; }