2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
4 #include "ace/streams.h"
6 static const ACE_TCHAR
*ior
= ACE_TEXT ("file://server.ior");
9 parse_args (int argc
, ACE_TCHAR
*argv
[])
11 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:x"));
14 while ((c
= get_opts ()) != -1)
18 ior
= get_opts
.opt_arg ();
23 ACE_ERROR_RETURN ((LM_ERROR
,
30 // Indicates successful parsing of the command line
35 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
37 #if defined (ACE_WIN32)
38 ACE_UNUSED_ARG (argc
);
39 ACE_UNUSED_ARG (argv
);
40 cout
<< "HandleExhaustion test not available on Windows" << endl
;
45 CORBA::ORB_init (argc
, argv
);
47 if (parse_args (argc
, argv
) != 0)
50 CORBA::Object_var tmp
=
51 orb
->string_to_object (ior
);
53 Test_var test
= Test::_narrow(tmp
.in ());
55 if (CORBA::is_nil (test
.in ()))
57 ACE_ERROR_RETURN ((LM_DEBUG
, "Nil Test reference <%s>\n", ior
), 1);
60 // Try a few times until we run out of "trys" or we no longer get
62 for(size_t i
= 0; i
< 10; i
++)
65 cout
<< "Client: calling simple, i = " << i
<< endl
;
66 // This first invocation will actually cause the connection to
67 // the server. Since the server has run out of file handles,
68 // it can not accept the new connection. On some platforms, this will
69 // receive a CORBA::COMM_FAILURE exception because it doesn't
70 // complete in a timely manner. It does not mean that the test
71 // has failed, as long as the server performs the correct
76 catch (const CORBA::COMM_FAILURE
&)
78 cout
<< "Client: simple raised COMMFAIL, i = " << i
<< endl
;
82 cout
<< "Client: calling simple again" << endl
;
84 cout
<< "Client: calling shutdown" << endl
;
89 catch (const CORBA::Exception
& ex
)
91 ex
._tao_print_exception ("Exception caught:");
94 #endif /* ACE_WIN32 */