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
= 5;
12 // # of nested calls to be made.
15 // The test is quiet...
20 Client_Task (client_ptr c
,
29 Client_Task::Client_Task (client_ptr c
,
31 : client_ (client::_duplicate (c
)),
32 server_ (server::_duplicate (s
))
43 "(%t) Client_Task::svc calling start -> time to live = %d\n",
46 // Now, we can invoke an operation on the remote side.
47 this->server_
->start (this->client_
.in (),
50 catch (const CORBA::Exception
& ex
)
52 ex
._tao_print_exception ("Client_Task::svc");
62 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("qxn:k:"));
65 while ((c
= get_opts ()) != -1)
77 call_count
= ACE_OS::atoi (get_opts
.opt_arg ());
81 ior
= get_opts
.opt_arg ();
86 ACE_ERROR_RETURN ((LM_ERROR
,
88 " [-n number of nested calls]"
91 " [-x (shutdown server)]"
98 ACE_ERROR_RETURN ((LM_ERROR
,
99 "%s: no nested up calls server ior specified\n",
103 // Indicates successful parsing of command line.
113 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
115 int result
= parse_args (argc
, argv
);
119 CORBA::Object_var object
= orb
->resolve_initial_references ("RootPOA");
121 PortableServer::POA_var root_poa
=
122 PortableServer::POA::_narrow (object
.in ());
124 PortableServer::POAManager_var poa_manager
=
125 root_poa
->the_POAManager ();
127 poa_manager
->activate ();
129 object
= orb
->string_to_object (ior
);
131 server_var server
= server::_narrow (object
.in ());
133 // Create an client object to hand to the other side...
134 client_i
client_servant (quiet
,
137 PortableServer::ObjectId_var id
=
138 root_poa
->activate_object (&client_servant
);
140 CORBA::Object_var object_act
= root_poa
->id_to_reference (id
.in ());
142 client_var client_object
= client::_narrow (object_act
.in ());
144 Client_Task
client_tasks (client_object
.in (),
154 root_poa
->destroy (true, true);
156 catch (const CORBA::Exception
& ex
)
158 ex
._tao_print_exception ("client::main");