2 #include "ace/Get_Opt.h"
3 #include "ace/streams.h"
5 const ACE_TCHAR
*ior
= ACE_TEXT("file://obj.ior");
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:n:i:"));
16 while ((c
= get_opts ()) != -1)
20 ior
= get_opts
.opt_arg ();
24 number
= ACE_OS::atoi (get_opts
.opt_arg ());
28 niterations
= ACE_OS::atoi (get_opts
.opt_arg ());
33 ACE_ERROR_RETURN ((LM_ERROR
,
41 // Indicates successful parsing of the command line
46 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
51 CORBA::ORB_init (argc
, argv
);
53 if (parse_args (argc
, argv
) != 0)
56 CORBA::Object_var tmp
=
57 orb
->string_to_object (ior
);
59 Test::StockFactory_var stockfactory
=
60 Test::StockFactory::_narrow (tmp
.in ());
62 if (CORBA::is_nil (stockfactory
.in ()))
64 ACE_ERROR_RETURN ((LM_DEBUG
,
65 "Nil Test::StockFactory reference <%s>\n",
70 ACE_DEBUG ((LM_DEBUG
, "Starting Client %d\n", number
));
72 for (int i
= 0; i
< niterations
; ++i
)
74 Test::Stock_var stock
=
75 stockfactory
->get_stock ("RHAT");
77 CORBA::String_var full_name
= stock
->full_name ();
79 CORBA::Double price
= stock
->price ();
81 ACE_DEBUG ((LM_DEBUG
, "The price of a stock in \"%s\" is $%f\n",
86 //stockfactory->shutdown ();
90 catch (const CORBA::Exception
& ex
)
92 ex
._tao_print_exception ("Exception caught in client.cpp:");