Changeset 4946 in ntrip
- Timestamp:
- Feb 23, 2013, 4:24:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GnssCenter/thrift/test2/server.cpp
r4945 r4946 6 6 #include <thrift/transport/TServerSocket.h> 7 7 #include <thrift/transport/TBufferTransports.h> 8 #include <thrift/concurrency/Thread.h> 8 9 9 10 #include "gen-cpp/myService.h" … … 15 16 using namespace ::apache::thrift::transport; 16 17 using namespace ::apache::thrift::server; 18 using namespace ::apache::thrift::concurrency; 17 19 18 20 class myService : virtual public myServiceIf { … … 52 54 }; 53 55 56 class t_serverThread : public Runnable { 57 public: 58 t_serverThread() {} 59 void run() { 60 int port = 9090; 61 shared_ptr<TServerSocket> serverTransport(new TServerSocket(port)); 62 shared_ptr<myProcessorFactory> processorFactory(new myProcessorFactory()); 63 shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory()); 64 shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory()); 65 66 TThreadedServer server(processorFactory, serverTransport, 67 transportFactory, protocolFactory); 68 server.serve(); 69 } 70 }; 71 54 72 int main(int argc, char **argv) { 55 int port = 9090;56 shared_ptr<TServerSocket> serverTransport(new TServerSocket(port));57 shared_ptr<myProcessorFactory> processorFactory(new myProcessorFactory());58 shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());59 shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());60 73 61 TThreadedServer server(processorFactory, serverTransport,62 transportFactory, protocolFactory);74 t_serverThread serverThread; 75 serverThread.run(); 63 76 64 server.serve(); 77 while (true) { 78 sleep(1); 79 } 65 80 66 81 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.