David Reiss | 9f3296b | 2010-08-31 16:58:41 +0000 | [diff] [blame] | 1 | #include <iostream> |
| 2 | #include <cstdlib> |
Roger Meier | 49ff8b1 | 2012-04-13 09:12:31 +0000 | [diff] [blame] | 3 | #include <thrift/protocol/TBinaryProtocol.h> |
David Reiss | 9f3296b | 2010-08-31 16:58:41 +0000 | [diff] [blame] | 4 | |
| 5 | #include "zmq.hpp" |
| 6 | #include "TZmqClient.h" |
| 7 | #include "Storage.h" |
| 8 | |
cyy | 316723a | 2019-01-05 16:35:14 +0800 | [diff] [blame] | 9 | using apache::thrift::std::shared_ptr; |
David Reiss | 9f3296b | 2010-08-31 16:58:41 +0000 | [diff] [blame] | 10 | using apache::thrift::transport::TZmqClient; |
| 11 | using apache::thrift::protocol::TBinaryProtocol; |
| 12 | |
| 13 | int main(int argc, char** argv) { |
| 14 | const char* endpoint = "epgm://eth0;239.192.1.1:5555"; |
| 15 | int socktype = ZMQ_PUB; |
| 16 | int incr = 1; |
| 17 | if (argc > 1) { |
| 18 | incr = atoi(argv[1]); |
| 19 | } |
| 20 | |
| 21 | zmq::context_t ctx(1); |
| 22 | shared_ptr<TZmqClient> transport(new TZmqClient(ctx, endpoint, socktype)); |
| 23 | shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(transport)); |
| 24 | StorageClient client(protocol); |
| 25 | |
| 26 | transport->open(); |
| 27 | |
| 28 | client.incr(incr); |
| 29 | usleep(50000); |
| 30 | |
| 31 | return 0; |
| 32 | } |