Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / APG / Reactor / Client.h
blobf282ee06fe3c834688df55510284450c227e5305
1 /**
2 * Sample code from The ACE Programmer's Guide,
3 * copyright 2003 Addison-Wesley. All Rights Reserved.
4 */
6 #ifndef __CLIENT_H_
7 #define __CLIENT_H_
9 #include "ace/Synch_Traits.h"
10 #include "ace/Null_Condition.h"
11 #include "ace/Null_Mutex.h"
13 // Listing 1 code/ch07
14 #include "ace/Reactor.h"
15 #include "ace/INET_Addr.h"
16 #include "ace/SOCK_Stream.h"
17 #include "ace/SOCK_Connector.h"
18 #include "ace/Connector.h"
19 #include "ace/Svc_Handler.h"
20 #include "ace/Reactor_Notification_Strategy.h"
22 class Client :
23 public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
25 typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> super;
27 public:
28 Client () : notifier_ (0, this, ACE_Event_Handler::WRITE_MASK)
31 virtual int open (void * = 0);
33 // Called when input is available from the client.
34 virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
36 // Called when output is possible.
37 virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE);
39 // Called when a timer expires.
40 virtual int handle_timeout (const ACE_Time_Value &current_time,
41 const void *act = 0);
43 private:
44 enum { ITERATIONS = 5 };
45 int iterations_;
46 ACE_Reactor_Notification_Strategy notifier_;
48 // Listing 1
50 #endif /* __CLIENT_H_ */