Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Server_Leaks / client.cpp
blobb399bf730afecbf6a64793cd27c2f8bd2709d952
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
5 int do_shutdown = 0;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:x"));
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 'x':
21 do_shutdown = 1;
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "-x "
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 =
44 CORBA::ORB_init (argc, argv);
46 if (parse_args (argc, argv) != 0)
47 return 1;
49 CORBA::Object_var tmp =
50 orb->string_to_object(ior);
52 Test::Ping_Service_var ping_service =
53 Test::Ping_Service::_narrow(tmp.in ());
55 if (CORBA::is_nil (ping_service.in ()))
57 ACE_ERROR_RETURN ((LM_DEBUG,
58 "Nil process reference <%s>\n",
59 ior),
60 1);
63 for (int i = 0; i != 10; ++i)
65 ping_service->ping ();
68 if (do_shutdown)
70 ping_service->shutdown ();
73 orb->destroy ();
75 catch (const CORBA::Exception& ex)
77 ex._tao_print_exception ("Exception caught:");
78 return 1;
81 return 0;