1
#include
<
iostream
>
2 using namespace std;
3 4 " ace/Init_ACE.h 5 6 ace/INET_Addr.h 7 ace/SOCK_Stream.h 8 ace/SOCK_Connector.h 9 ace/SOCK_Acceptor.h 10 ace/Acceptor.h 11 12 ace/Reactor.h 13 ace/Dev_Poll_Reactor.h 14 ace/Event_Handler.h 15 ace/Svc_Handler.h 16 17 class TestHandler;
18 typedefACE_Acceptor TestHandler,ACE_SOCK_ACCEPTOR TestAccptor;
19 20 TestHandler: public ACE_Svc_Handler ACE_SOCK_STREAM,ACE_NULL_SYNCH 21 {
22public:
23typedefACE_Svc_Handler<>super;
24
25intopen(void*/*=0*/);
26handle_input(ACE_HANDLEfd=ACE_INVALID_HANDLE27handle_output(ACE_HANDLEfd28handle_close(ACE_HANDLE,ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK29} ;
30 31 int TestHandler::open( void * )
32 33returnreactor()->register_handler(this3435 36 TestHandler::handle_input(ACE_HANDLEfd)
37 38charbuf[128]={0};
39retpeer().recv(buf,12740if(ret<=)41-1424344buf[ret]45printf("%s 464748 49 TestHandler::handle_output(ACE_HANDLEfd)
50 5152ACE_OS::sprintf(buf,0);">client%uget_handle());
53peer().send(buf,strlen(buf));
5455cancel_wakeup(//SelectisLT565758 59 TestHandler::handle_close(ACE_HANDLE,ACE_Reactor_Mask)
60 61delete626364 65 main( 66 67ACE::init();
6869ACE_Dev_Poll_Reactordev_reactor(102470ACE_Reactorreactor(&dev_reactor);
71ACE_Reactor::instance(reactor);
7273TestAccptoraccptor;
74ACE_INET_Addraddr(1000075(accptor.open(addr)==76cout<<OpenportFailed..endl;
7778 7980 Openportok..endl;
818283ACE_Reactor::instance()run_reactor_event_loop();
84ACE::fini();
8586
2 using namespace std;
3 4 " ace/Init_ACE.h 5 6 ace/INET_Addr.h 7 ace/SOCK_Stream.h 8 ace/SOCK_Connector.h 9 ace/SOCK_Acceptor.h 10 ace/Acceptor.h 11 12 ace/Reactor.h 13 ace/Dev_Poll_Reactor.h 14 ace/Event_Handler.h 15 ace/Svc_Handler.h 16 17 class TestHandler;
18 typedefACE_Acceptor TestHandler,ACE_SOCK_ACCEPTOR TestAccptor;
19 20 TestHandler: public ACE_Svc_Handler ACE_SOCK_STREAM,ACE_NULL_SYNCH 21 {
22public:
23typedefACE_Svc_Handler<>super;
24
25intopen(void*/*=0*/);
26handle_input(ACE_HANDLEfd=ACE_INVALID_HANDLE27handle_output(ACE_HANDLEfd28handle_close(ACE_HANDLE,ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK29} ;
30 31 int TestHandler::open( void * )
32 33returnreactor()->register_handler(this3435 36 TestHandler::handle_input(ACE_HANDLEfd)
37 38charbuf[128]={0};
39retpeer().recv(buf,12740if(ret<=)41-1424344buf[ret]45printf("%s 464748 49 TestHandler::handle_output(ACE_HANDLEfd)
50 5152ACE_OS::sprintf(buf,0);">client%uget_handle());
53peer().send(buf,strlen(buf));
5455cancel_wakeup(//SelectisLT565758 59 TestHandler::handle_close(ACE_HANDLE,ACE_Reactor_Mask)
60 61delete626364 65 main( 66 67ACE::init();
6869ACE_Dev_Poll_Reactordev_reactor(102470ACE_Reactorreactor(&dev_reactor);
71ACE_Reactor::instance(reactor);
7273TestAccptoraccptor;
74ACE_INET_Addraddr(1000075(accptor.open(addr)==76cout<<OpenportFailed..endl;
7778 7980 Openportok..endl;
818283ACE_Reactor::instance()run_reactor_event_loop();
84ACE::fini();
8586