Changeset 4946 in ntrip for trunk/GnssCenter


Ignore:
Timestamp:
Feb 23, 2013, 4:24:34 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GnssCenter/thrift/test2/server.cpp

    r4945 r4946  
    66#include <thrift/transport/TServerSocket.h>
    77#include <thrift/transport/TBufferTransports.h>
     8#include <thrift/concurrency/Thread.h>
    89
    910#include "gen-cpp/myService.h"
     
    1516using namespace ::apache::thrift::transport;
    1617using namespace ::apache::thrift::server;
     18using namespace ::apache::thrift::concurrency;
    1719
    1820class myService : virtual public myServiceIf {
     
    5254};
    5355
     56class 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
    5472int 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());
    6073
    61   TThreadedServer server(processorFactory, serverTransport,
    62                          transportFactory, protocolFactory);
     74  t_serverThread serverThread;
     75  serverThread.run();
    6376
    64   server.serve();
     77  while (true) {
     78    sleep(1);
     79  }
    6580
    6681  return 0;
Note: See TracChangeset for help on using the changeset viewer.