Example 4
typedef ACE_Connector<My_Svc_Handler,ACE_SOCK_CONNECTOR> MyConnector;

int main(int argc, char * argv[]){
 ACE_INET_Addr addr(PORT_NO,HOSTNAME);
 My_Svc_Handler * handler= new My_Svc_Handler;

//Create the connector
 MyConnector connector;

//Connects to remote machine
 if(connector.connect(handler,addr)==-1)
  ACE_ERROR(LM_ERROR,”%P|%t, %p”,”Connection failed”);
 

//Registers with the Reactor
 while(1)
  ACE_Reactor::instance()->handle_events();
}

 Next Page