Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 1 | #ifndef T_SERVER_SOCKET_H |
2 | #define T_SERVER_SOCKET_H | ||||
3 | |||||
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame^] | 4 | #include <transport/TServerTransport.h> |
5 | #include <boost/shared_ptr.hpp> | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 6 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 7 | namespace facebook { namespace thrift { namespace transport { |
8 | |||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 9 | class 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 | */ | ||||
17 | class TServerSocket : public TServerTransport { | ||||
18 | public: | ||||
19 | TServerSocket(int port); | ||||
20 | ~TServerSocket(); | ||||
21 | |||||
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 22 | void listen(); |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 23 | void close(); |
24 | |||||
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 25 | protected: |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame^] | 26 | shared_ptr<TTransport> acceptImpl(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 27 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 28 | private: |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 29 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 30 | int port_; |
31 | int serverSocket_; | ||||
32 | int acceptBacklog_; | ||||
33 | }; | ||||
34 | |||||
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 35 | }}} // facebook::thrift::transport |
36 | |||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 37 | #endif |