blob: a4a2d98a81224aff47f52dbd624da57c54f31096 [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_SIMPLE_SERVER_H
2#define T_SIMPLE_SERVER_H
3
4#include "server/TServer.h"
5#include "transport/TServerTransport.h"
6
Marc Slemko6f038a72006-08-03 18:58:09 +00007namespace facebook { namespace thrift { namespace server {
8
Mark Sleee8540632006-05-30 09:24:40 +00009/**
10 * This is the most basic simple server. It is single-threaded and runs a
11 * continuous loop of accepting a single connection, processing requests on
12 * that connection until it closes, and then repeating. It is a good example
13 * of how to extend the TServer interface.
14 *
15 * @author Mark Slee <mcslee@facebook.com>
16 */
17class TSimpleServer : public TServer {
18 public:
Mark Slee8d7e1f62006-06-07 06:48:56 +000019 TSimpleServer(TProcessor* processor,
Mark Sleee8540632006-05-30 09:24:40 +000020 TServerOptions* options,
21 TServerTransport* serverTransport) :
Mark Slee8d7e1f62006-06-07 06:48:56 +000022 TServer(processor, options), serverTransport_(serverTransport) {}
Mark Sleee8540632006-05-30 09:24:40 +000023
24 ~TSimpleServer() {}
25
26 void run();
27
28 protected:
29 TServerTransport* serverTransport_;
30};
31
Marc Slemko6f038a72006-08-03 18:58:09 +000032}}} // facebook::thrift::server
33
Mark Sleee8540632006-05-30 09:24:40 +000034#endif