2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
4 #include "tao/Object_T.h"
7 ACE_TCHAR
const *ior
= ACE_TEXT ("file://test.ior");
8 CORBA::ULong threads
= 2u;
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT ("k:t:"));
16 while ((c
= get_opts ()) != -1)
20 ior
= get_opts
.opt_arg ();
24 threads
= ACE_OS::strtoul (get_opts
.opt_arg (), 0, 10);
29 ACE_ERROR_RETURN ((LM_ERROR
,
30 ACE_TEXT ("usage: %s ")
31 ACE_TEXT ("-k <ior> ")
32 ACE_TEXT ("-t <number of threads server has> ")
39 ACE_TEXT ("args to be used: -k '%s' -t %d\n"),
43 // Indicates sucessful parsing of the command line
48 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
52 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
54 if (parse_args (argc
, argv
) != 0)
55 ACE_ERROR_RETURN ((LM_ERROR
,
56 ACE_TEXT ("ERROR: wrong arguments\n")),
59 CORBA::Object_var obj
= orb
->string_to_object (ior
);
61 // Create Hello reference.
62 Test::UIPMC_Object_var test
=
63 TAO::Narrow_Utils
<Test::UIPMC_Object
>::unchecked_narrow (obj
.in ());
65 if (CORBA::is_nil (test
.in ()))
66 ACE_ERROR_RETURN ((LM_ERROR
,
67 ACE_TEXT ("ERROR: IOR is not an UIPMC_Object\n")),
70 for (CORBA::ULong j
= 0u; j
< threads
; ++j
)
74 ACE_DEBUG ((LM_DEBUG
, "Sending request %u\n", (unsigned) (j
+1u)));
77 catch (const CORBA::Exception
& ex
)
79 ex
._tao_print_exception ("Exception caught during send\n");
83 // Give a chance to flush all OS buffers for client.
84 while (orb
->work_pending ())
87 ACE_DEBUG ((LM_DEBUG
, "Client shutting down\n"));
90 catch (const CORBA::Exception
& ex
)
92 ex
._tao_print_exception ("Exception caught in client main ():");
97 ACE_TEXT ("\nClient finished successfully\n")));