parent
ef1f25e9b3
commit
8cf07b67ae
@ -1,4 +1,8 @@ |
||||
a.out |
||||
db |
||||
*.swp |
||||
|
||||
*.o |
||||
*.d |
||||
dump |
||||
client |
||||
server |
||||
|
@ -0,0 +1,43 @@ |
||||
#include <stdio.h> |
||||
#include <unistd.h> |
||||
#include <protocol/TBinaryProtocol.h> |
||||
#include <transport/TSocket.h> |
||||
#include <transport/TTransportUtils.h> |
||||
#include "Pos.h" |
||||
#include "sha1.h" |
||||
#include <iostream> |
||||
|
||||
using namespace std; |
||||
using namespace apache::thrift; |
||||
using namespace apache::thrift::protocol; |
||||
using namespace apache::thrift::transport; |
||||
|
||||
using namespace pos; |
||||
|
||||
using namespace boost; |
||||
|
||||
int main(int argc, char** argv) { |
||||
if (argc != 2) { |
||||
cout << "Usage: dump <host>\n"; |
||||
exit(1); |
||||
} |
||||
shared_ptr<TTransport> socket(new TSocket(argv[1], 9090)); |
||||
shared_ptr<TTransport> transport(new TFramedTransport(socket)); |
||||
shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); |
||||
PosClient client(protocol); |
||||
|
||||
try { |
||||
transport->open(); |
||||
} catch(TException & e) { |
||||
std::cerr << e.what() << "\n"; |
||||
exit(1); |
||||
} |
||||
|
||||
vector<string> data; |
||||
client.toString(data); |
||||
for (uint32_t i = 0; i < data.size(); i++) { |
||||
cout << data[i] << "\n"; |
||||
} |
||||
return 0; |
||||
} |
||||
|
Loading…
Reference in new issue