blob: 619a3669004a9637c09138928a83093aa8b64d07 [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_SERVER_SOCKET_H
2#define T_SERVER_SOCKET_H
3
Marc Slemko16698852006-08-04 03:16:10 +00004#include <transport/TServerTransport.h>
5#include <boost/shared_ptr.hpp>
Mark Sleee8540632006-05-30 09:24:40 +00006
Marc Slemko6f038a72006-08-03 18:58:09 +00007namespace facebook { namespace thrift { namespace transport {
8
Mark Sleee8540632006-05-30 09:24:40 +00009class TSocket;
10
11/**
12 * Server socket implementation of TServerTransport. Wrapper around a unix
13 * socket listen and accept calls.
14 *
15 * @author Mark Slee <mcslee@facebook.com>
16 */
17class TServerSocket : public TServerTransport {
18 public:
19 TServerSocket(int port);
20 ~TServerSocket();
21
Mark Slee8d7e1f62006-06-07 06:48:56 +000022 void listen();
Mark Sleee8540632006-05-30 09:24:40 +000023 void close();
24
Mark Slee8d7e1f62006-06-07 06:48:56 +000025 protected:
Marc Slemko16698852006-08-04 03:16:10 +000026 shared_ptr<TTransport> acceptImpl();
Mark Slee8d7e1f62006-06-07 06:48:56 +000027
Mark Sleee8540632006-05-30 09:24:40 +000028 private:
Mark Slee8d7e1f62006-06-07 06:48:56 +000029
Mark Sleee8540632006-05-30 09:24:40 +000030 int port_;
31 int serverSocket_;
32 int acceptBacklog_;
33};
34
Marc Slemko6f038a72006-08-03 18:58:09 +000035}}} // facebook::thrift::transport
36
Mark Sleee8540632006-05-30 09:24:40 +000037#endif