Mark Slee | c416a27 | 2007-03-05 05:40:37 +0000 | [diff] [blame] | 1 | // This autogenerated skeleton file illustrates how to build a server. |
| 2 | // You should copy it to another filename to avoid overwriting it. |
| 3 | |
| 4 | #include "ThreadsTest.h" |
| 5 | #include <protocol/TBinaryProtocol.h> |
| 6 | #include <server/TThreadPoolServer.h> |
| 7 | #include <transport/TSocket.h> |
| 8 | #include <transport/TTransportUtils.h> |
| 9 | #include <thrift/concurrency/Monitor.h> |
| 10 | #include <thrift/concurrency/ThreadManager.h> |
| 11 | #include <thrift/concurrency/PosixThreadFactory.h> |
| 12 | |
Mark Slee | 02d1edc | 2007-03-07 05:17:25 +0000 | [diff] [blame] | 13 | using boost::shared_ptr; |
Mark Slee | c416a27 | 2007-03-05 05:40:37 +0000 | [diff] [blame] | 14 | using namespace facebook::thrift; |
| 15 | using namespace facebook::thrift::protocol; |
| 16 | using namespace facebook::thrift::transport; |
| 17 | using namespace facebook::thrift::server; |
| 18 | using namespace facebook::thrift::concurrency; |
| 19 | |
| 20 | int main(int argc, char **argv) { |
| 21 | int port = 9090; |
| 22 | std::string host = "localhost"; |
| 23 | |
| 24 | shared_ptr<TTransport> transport(new TSocket(host, port)); |
| 25 | shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); |
| 26 | |
| 27 | transport->open(); |
| 28 | |
| 29 | ThreadsTestClient client(protocol); |
| 30 | int val; |
| 31 | val = client.threadOne(5); |
| 32 | fprintf(stderr, "%d\n", val); |
| 33 | val = client.stop(); |
| 34 | fprintf(stderr, "%d\n", val); |
| 35 | val = client.threadTwo(5); |
| 36 | fprintf(stderr, "%d\n", val); |
| 37 | |
| 38 | transport->close(); |
| 39 | |
| 40 | fprintf(stderr, "done.\n"); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |