source: ntrip/trunk/GnssCenter/thrift/test1/client.cpp@ 10200

Last change on this file since 10200 was 4939, checked in by mervart, 12 years ago
File size: 950 bytes
Line 
1#include <iostream>
2
3#include <thrift/protocol/TBinaryProtocol.h>
4#include <thrift/transport/TSocket.h>
5#include <thrift/transport/TTransportUtils.h>
6
7#include "gen-cpp/myService.h"
8
9using namespace std;
10using namespace boost;
11using namespace apache::thrift;
12using namespace apache::thrift::protocol;
13using namespace apache::thrift::transport;
14
15int main(int argc, char** argv) {
16 int port = 9090;
17 shared_ptr<TSocket> socket(new TSocket("localhost", port));
18 shared_ptr<TTransport> transport(new TBufferedTransport(socket));
19 shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
20 myServiceClient client(protocol);
21
22 try {
23 transport->open();
24
25 while (true) {
26 string answ;
27 client.answer(answ, "How are you?");
28 cout << "Server answers: " << answ << endl;
29 sleep(1);
30 }
31
32 transport->close();
33 } catch (TException& exc) {
34 cout << "Exception: " << exc.what() << endl;
35 }
36
37 return 0;
38}
Note: See TracBrowser for help on using the repository browser.