Merge pull request #2316 from jwillemsen/jwi-taskcommenttypo
[ACE_TAO.git] / ACE / examples / Logger / simple-server / Logging_Handler.h
blob7aa8ea3b387070516389ada146dd971aa5db6322
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Logging_Handler.h
7 * @author Doug Schmidt
8 */
9 //=============================================================================
11 #ifndef _CLIENT_HANDLER_H
12 #define _CLIENT_HANDLER_H
14 #include "ace/Event_Handler.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "ace/INET_Addr.h"
21 #include "ace/SOCK_Stream.h"
22 #include "ace/os_include/os_netdb.h"
24 /**
25 * @class Logging_Handler
27 * @brief Receive client message from the remote clients.
29 * This class demonstrates how to receive messages from remote
30 * clients using the notification mechanisms in the
31 * <ACE_Reactor>. In addition, it also illustrates how to
32 * utilize the <ACE_Reactor> timer mechanisms, as well.
34 class Logging_Handler : public ACE_Event_Handler
36 public:
37 Logging_Handler () = default;
39 // = Hooks for opening and closing handlers.
40 virtual int open ();
41 virtual int close ();
43 /// Conversion operators.
44 ACE_SOCK_Stream &peer ();
46 protected:
47 // = Demultiplexing hooks.
48 ACE_HANDLE get_handle () const override;
49 int handle_input (ACE_HANDLE) override;
50 int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
51 ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) override;
52 int handle_timeout (const ACE_Time_Value &tv, const void *arg) override;
54 // = Really should be private...
55 /// Ensure dynamic allocation.
56 virtual ~Logging_Handler ();
58 private:
59 /// Host we are connected to.
60 char host_name_[MAXHOSTNAMELEN + 1];
62 /// Connection with client
63 ACE_SOCK_Stream cli_stream_;
66 #endif /* _CLIENT_HANDLER_H */