2 #include "ace/Get_Opt.h"
5 static const ACE_TCHAR
*ior
= ACE_TEXT ("file://test.ior");
8 static int shutdown_server
= 0;
9 // Flag to tell server to shutdown.
11 static CORBA::UShort call_count
= 2;
12 // # of nested calls to be made.
15 // The test is quiet...
20 Client_Task (client_ptr c
,
24 bool exception () const;
31 Client_Task::Client_Task (client_ptr c
,
33 : client_ (client::_duplicate (c
)),
34 server_ (server::_duplicate (s
))
45 "(%t) Client_Task::svc calling start -> time to live = %d\n",
48 // Now, we can invoke an operation on the remote side.
49 this->server_
->start (this->client_
.in (),
52 catch (const CORBA::Exception
& ex
)
54 ex
._tao_print_exception ("Client_Task::svc");
64 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("qxn:k:"));
67 while ((c
= get_opts ()) != -1)
79 call_count
= ACE_OS::atoi (get_opts
.opt_arg ());
83 ior
= get_opts
.opt_arg ();
88 ACE_ERROR_RETURN ((LM_ERROR
,
90 " [-n number of nested calls]"
93 " [-x (shutdown server)]"
100 ACE_ERROR_RETURN ((LM_ERROR
,
101 "%s: no nested up calls server ior specified\n",
105 // Indicates successful parsing of command line.
116 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
118 result
= parse_args (argc
, argv
);
122 CORBA::Object_var object
= orb
->resolve_initial_references ("RootPOA");
124 PortableServer::POA_var root_poa
=
125 PortableServer::POA::_narrow (object
.in ());
127 PortableServer::POAManager_var poa_manager
=
128 root_poa
->the_POAManager ();
130 poa_manager
->activate ();
132 object
= orb
->string_to_object (ior
);
134 server_var server
= server::_narrow (object
.in ());
136 // Create an client object to hand to the other side...
137 client_i
client_servant (quiet
,
140 PortableServer::ObjectId_var id
=
141 root_poa
->activate_object (&client_servant
);
143 CORBA::Object_var object_act
= root_poa
->id_to_reference (id
.in ());
145 client_var client_object
= client::_narrow (object_act
.in ());
147 Client_Task
client_tasks (client_object
.in (),
157 root_poa
->destroy (true, true);
161 catch (const CORBA::Exception
& ex
)
163 ex
._tao_print_exception ("client::main");