1 #include "ace/SString.h"
2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
5 #include "tao/ORB_Constants.h"
7 const ACE_TCHAR
*proxy_ior
= 0;
8 const ACE_TCHAR
*control_ior
= 0;
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("p:c:"));
16 while ((c
= get_opts ()) != -1)
20 proxy_ior
= get_opts
.opt_arg ();
23 control_ior
= get_opts
.opt_arg ();
27 ACE_ERROR_RETURN ((LM_ERROR
,
35 // Indicates successful parsing of the command line
40 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
45 CORBA::ORB_init (argc
, argv
);
47 if (parse_args (argc
, argv
) == -1)
50 CORBA::Object_var obj
=
51 orb
->string_to_object (proxy_ior
);
55 ACE_ERROR_RETURN ((LM_ERROR
,
56 "The received object is nil\n"),
60 Simple_Server_var server
=
61 Simple_Server::_narrow (obj
.in ());
63 if (CORBA::is_nil (server
.in ()))
65 ACE_ERROR_RETURN ((LM_ERROR
,
66 "Object reference is nil\n"),
75 server
->remote_call ();
79 catch (const CORBA::TRANSIENT
& ex
)
81 CORBA::ULong m
= ex
.minor () & 0x00000F80u
;
82 if (m
== TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE
&&
83 ex
.completed () == CORBA::COMPLETED_NO
)
86 "TRANSIENT caught in client as it was expected.\n"));
90 ex
._tao_print_exception ("Unexpected TRANSIENT caught in client:");
96 orb
->string_to_object (control_ior
);
100 ACE_ERROR_RETURN ((LM_ERROR
,
101 "The received objref is NULL\n"),
106 Simple_Server::_narrow (obj
.in ());
112 catch (const CORBA::Exception
& ex
)
114 ex
._tao_print_exception ("Exception caught in client:");