3 #include "ace/Get_Opt.h"
4 #include "ace/OS_NS_unistd.h"
7 ACE_TCHAR
*server_ior
= 0;
8 bool expect_transient
= false;
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("ek:n:"));
16 while ((c
= get_opts ()) != -1)
20 expect_transient
= true;
24 server_ior
= get_opts
.opt_arg ();
28 client_num
= ACE_OS::atoi (get_opts
.opt_arg ());
33 ACE_ERROR_RETURN ((LM_ERROR
,
34 ACE_TEXT ("usage: %s ")
36 ACE_TEXT ("-k <server-ior> ")
41 // Indicates successful parsing of the command line
46 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
50 CORBA::ORB_var orb
= CORBA::ORB_init(argc
, argv
);
52 if (parse_args (argc
, argv
) != 0)
56 ACE_TEXT ("(%P|%t|%T) Client %d sending request to %C\n"),
57 client_num
, server_ior
));
60 CORBA::Object_var obj
=
61 orb
->string_to_object (server_ior
);
62 ACE_ASSERT (!CORBA::is_nil (obj
.in ()));
63 Test_var test
= Test::_narrow (obj
.in());
64 ACE_ASSERT (!CORBA::is_nil (test
.in()));
65 CORBA::Short n
= test
->get_server_num ();
67 ACE_TEXT ("(%P|%t|%T) Client %d received reply from server %d\n"),
70 catch (const CORBA::TRANSIENT
&)
75 ACE_TEXT ("(%P|%t|%T) Client %d got expected transient exception\n"),
81 ACE_TEXT ("(%P|%t|%T) Client %d caught unexpected transent\n"),
88 catch(const CORBA::Exception
& ex
)
90 ex
._tao_print_exception (ACE_TEXT ("client:"));