Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Reactor / TP_Reactor / AcceptHandler.h
blob0a0fd089e769ad1756a41fe717f26ee51e97ad3a
1 /*
2 * ACE reactor demonstration
4 * Date: 26-Jan-2006
5 */
7 #ifndef __ACCEPTHANDLER_H__
8 #define __ACCEPTHANDLER_H__
10 #include <ace/Event_Handler.h>
11 #include <ace/Reactor.h>
12 #include <ace/SOCK_Acceptor.h>
14 /**
15 * This accept handler is based on the provided solution from the ACE course.
17 class AcceptHandler : public ACE_Event_Handler {
18 private:
19 /**
20 * The reactor to which the accept handler belongs.
22 ACE_Reactor *mReactor;
24 /**
25 * The socket used for incoming conections.
27 ACE_SOCK_Acceptor mAcceptor;
29 public:
30 /**
31 * @param reactor The reactor which will use this accept handler.
33 AcceptHandler(ACE_Reactor *reactor = 0);
35 /**
36 * The destructor exists for tracing purposes.
38 virtual ~AcceptHandler();
40 /**
41 * Open the listening socket and register the handler with the reactor.
43 * @return 0 on success, -1 on failure
45 int open();
47 /**
48 * @name Overridden methods from the ACE_Event_Handler
50 // @{
51 /**
52 * Provides the handle of mAcceptor.
54 virtual ACE_HANDLE get_handle() const;
56 /**
57 * Create a read handler for the new connection and register that
58 * handler with the reactor.
60 virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE);
62 /**
63 * Close the listening socket.
65 virtual int handle_close(ACE_HANDLE, ACE_Reactor_Mask);
66 // @}
69 #endif /* __ACCEPTHANDLER_H__ */