Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_3163_Regression / client.cpp
blob8e9f4f0d3b9c91e1238049e9b12abb15d6282766
1 #include "testC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
5 int message_size = 0;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:v:"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
17 ior = get_opts.opt_arg ();
18 break;
19 case 'v' :
20 message_size = ACE_OS::atoi (get_opts.opt_arg ());
21 break;
22 case '?':
23 default:
24 ACE_ERROR_RETURN ((LM_ERROR,
25 "usage: %s "
26 "-k <ior> "
27 "\n",
28 argv [0]),
29 -1);
31 // Indicates successful parsing of the command line
32 return 0;
35 int
36 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
38 try
40 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
42 if (parse_args (argc, argv) != 0)
43 return 1;
45 CORBA::Object_var tmp = orb->string_to_object(ior);
47 ctest_var hello = ctest::_narrow(tmp.in ());
49 if (CORBA::is_nil (hello.in ()))
51 ACE_ERROR_RETURN ((LM_DEBUG,
52 "Nil Test::Hello reference <%s>\n",
53 ior),
54 1);
57 ctest::UCSeq_var data;
59 hello->ctestfn(message_size, data.out ());
61 ACE_DEBUG ((LM_DEBUG, "Received %d bytes\n", data->length()));
63 hello->shutdown ();
65 orb->destroy ();
67 catch (const CORBA::Exception& ex)
69 ex._tao_print_exception ("Exception caught:");
70 return 1;
73 return 0;