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