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
61 // an exception. Some times it takes a little while to begin
62 // accepting again on AIX.
63 for(size_t i
= 0; i
< 10; i
++)
66 cout
<< "Client: calling simple, i = " << i
<< endl
;
67 // This first invocation will actually cause the connection to
68 // the server. Since the server has run out of file handles,
69 // it can not accept the new connection. On AIX, this will
70 // receive a CORBA::COMM_FAILURE exception because it doesn't
71 // complete in a timely manner. It does not mean that the test
72 // has failed, as long as the server performs the correct
77 catch (const CORBA::COMM_FAILURE
&)
79 cout
<< "Client: simple raised COMMFAIL, i = " << i
<< endl
;
83 cout
<< "Client: calling simple again" << endl
;
85 cout
<< "Client: calling shutdown" << endl
;
90 catch (const CORBA::Exception
& ex
)
92 ex
._tao_print_exception ("Exception caught:");
95 #endif /* ACE_WIN32 */