Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Multiple_Retry_Tests / Retry_On_Connection_Failure / client.cpp
blobd571ff4a1bd02a093a32b9fc02d9f348c577a505
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
5 bool oneway_call = false;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
17 ior = get_opts.opt_arg ();
18 break;
20 case 'o':
21 oneway_call = ACE_OS::atoi (get_opts.opt_arg ()) != 0;
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "-o <oneway flag> "
30 "\n",
31 argv [0]),
32 -1);
34 // Indicates successful parsing of the command line
35 return 0;
38 int
39 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
41 try
43 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
45 if (parse_args (argc, argv) != 0)
46 return 1;
48 CORBA::Object_var tmp = orb->string_to_object(ior);
50 Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
52 if (CORBA::is_nil (hello.in ()))
54 ACE_ERROR_RETURN ((LM_DEBUG,
55 "Nil Test::Hello reference <%s>\n",
56 ior),
57 1);
60 if (oneway_call)
62 CORBA::String_var the_string = CORBA::string_dup( "Test");
63 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Client sending string <%C> oneway\n",
64 the_string.in ()));
65 hello->set_string (the_string);
67 else
69 CORBA::String_var the_string = hello->get_string ();
70 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Client getting string <%C>\n",
71 the_string.in ()));
74 hello->shutdown ();
76 orb->destroy ();
78 catch (const CORBA::Exception& ex)
80 ex._tao_print_exception ("Exception caught:");
81 return 1;
84 return 0;