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 | |
| 6 | class TSocket; |
| 7 | |
| 8 | /** |
| 9 | * Server socket implementation of TServerTransport. Wrapper around a unix |
| 10 | * socket listen and accept calls. |
| 11 | * |
| 12 | * @author Mark Slee <mcslee@facebook.com> |
| 13 | */ |
| 14 | class TServerSocket : public TServerTransport { |
| 15 | public: |
| 16 | TServerSocket(int port); |
| 17 | ~TServerSocket(); |
| 18 | |
| 19 | bool listen(); |
| 20 | TTransport* accept(); |
| 21 | void close(); |
| 22 | |
| 23 | private: |
| 24 | int port_; |
| 25 | int serverSocket_; |
| 26 | int acceptBacklog_; |
| 27 | }; |
| 28 | |
| 29 | #endif |