Changeset 4952 in ntrip
- Timestamp:
- Feb 23, 2013, 5:24:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GnssCenter/thrift/test2/server.cpp
r4951 r4952 19 19 using namespace apache::thrift::concurrency; 20 20 21 class myService : virtual public myServiceIf {22 public:23 myService() {}24 void answer(const std::string& question) {25 // implemented on the client-side only26 }27 };28 29 21 class t_connection { 30 22 public: 31 shared_ptr<myService> _service;32 23 shared_ptr<myServiceClient> _client; 33 24 shared_ptr<TProcessor> _processor; … … 44 35 shared_ptr<TProcessor> getProcessor(const TConnectionInfo& info) { 45 36 shared_ptr<myServiceClient> client(new myServiceClient(info.output)); 46 shared_ptr< myService> service(new myService());47 shared_ptr<TProcessor> processor(new myServiceProcessor(service)); 48 cout << " connection " << endl;37 shared_ptr<TProcessor> processor(new myServiceProcessor(client)); 38 39 cout << "new connection " << endl; 49 40 50 41 CONNECTION.reset(new t_connection); 51 CONNECTION->_service = service;52 42 CONNECTION->_client = client; 53 43 CONNECTION->_processor = processor; … … 86 76 thread->start(); 87 77 88 cout << "server thread started" << endl; 89 90 while (true) { 91 cout << "sleep ..." << endl; 92 if (CONNECTION) { 93 cout << "CONNECTION " << endl; 94 CONNECTION->_client->answer("How are you?"); 78 try { 79 while (true) { 80 if (CONNECTION) { 81 CONNECTION->_client->answer("How are you?"); 82 } 83 sleep(1); 95 84 } 96 sleep(1); 85 } catch (TException& exc) { 86 cout << "Exception: " << exc.what() << endl; 97 87 } 98 88
Note:
See TracChangeset
for help on using the changeset viewer.