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 | |
| 13 | using namespace facebook::thrift; |
| 14 | using namespace facebook::thrift::protocol; |
| 15 | using namespace facebook::thrift::transport; |
| 16 | using namespace facebook::thrift::server; |
| 17 | using namespace facebook::thrift::concurrency; |
| 18 | |
| 19 | int main(int argc, char **argv) { |
| 20 | int port = 9090; |
| 21 | std::string host = "localhost"; |
| 22 | |
| 23 | shared_ptr<TTransport> transport(new TSocket(host, port)); |
| 24 | shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); |
| 25 | |
| 26 | transport->open(); |
| 27 | |
| 28 | ThreadsTestClient client(protocol); |
| 29 | int val; |
| 30 | val = client.threadOne(5); |
| 31 | fprintf(stderr, "%d\n", val); |
| 32 | val = client.stop(); |
| 33 | fprintf(stderr, "%d\n", val); |
| 34 | val = client.threadTwo(5); |
| 35 | fprintf(stderr, "%d\n", val); |
| 36 | |
| 37 | transport->close(); |
| 38 | |
| 39 | fprintf(stderr, "done.\n"); |
| 40 | |
| 41 | return 0; |
| 42 | } |
| 43 | |