blob: c18a8d2325fe21ab635d4eb2fcb40ec2a045f7e0 [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_SERVER_SOCKET_H
2#define T_SERVER_SOCKET_H
3
4#include "transport/TServerTransport.h"
5
Marc Slemko6f038a72006-08-03 18:58:09 +00006namespace facebook { namespace thrift { namespace transport {
7
Mark Sleee8540632006-05-30 09:24:40 +00008class TSocket;
9
10/**
11 * Server socket implementation of TServerTransport. Wrapper around a unix
12 * socket listen and accept calls.
13 *
14 * @author Mark Slee <mcslee@facebook.com>
15 */
16class TServerSocket : public TServerTransport {
17 public:
18 TServerSocket(int port);
19 ~TServerSocket();
20
Mark Slee8d7e1f62006-06-07 06:48:56 +000021 void listen();
Mark Sleee8540632006-05-30 09:24:40 +000022 void close();
23
Mark Slee8d7e1f62006-06-07 06:48:56 +000024 protected:
25 TTransport* acceptImpl();
26
Mark Sleee8540632006-05-30 09:24:40 +000027 private:
Mark Slee8d7e1f62006-06-07 06:48:56 +000028
Mark Sleee8540632006-05-30 09:24:40 +000029 int port_;
30 int serverSocket_;
31 int acceptBacklog_;
32};
33
Marc Slemko6f038a72006-08-03 18:58:09 +000034}}} // facebook::thrift::transport
35
Mark Sleee8540632006-05-30 09:24:40 +000036#endif