2 * ACE reactor demonstration
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>
15 * This accept handler is based on the provided solution from the ACE course.
17 class AcceptHandler
: public ACE_Event_Handler
{
20 * The reactor to which the accept handler belongs.
22 ACE_Reactor
*mReactor
;
25 * The socket used for incoming conections.
27 ACE_SOCK_Acceptor mAcceptor
;
31 * @param reactor The reactor which will use this accept handler.
33 AcceptHandler(ACE_Reactor
*reactor
= 0);
36 * The destructor exists for tracing purposes.
38 virtual ~AcceptHandler();
41 * Open the listening socket and register the handler with the reactor.
43 * @return 0 on success, -1 on failure
48 * @name Overridden methods from the ACE_Event_Handler
52 * Provides the handle of mAcceptor.
54 virtual ACE_HANDLE
get_handle() const;
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
);
63 * Close the listening socket.
65 virtual int handle_close(ACE_HANDLE
, ACE_Reactor_Mask
);
69 #endif /* __ACCEPTHANDLER_H__ */