3 #include "tao/Strategies/advanced_resource.h"
5 #include "ace/Get_Opt.h"
6 #include "ace/OS_NS_stdio.h"
7 #include "ace/SString.h"
10 struct Servant
: virtual POA_Test::Hello
12 explicit Servant (const CORBA::ORB_var
&orb
)
18 CORBA::String_var
str ("hello");
24 this->orb_
->shutdown (0);
30 struct ORBTask
: ACE_Task_Base
32 explicit ORBTask (const CORBA::ORB_var
&orb
)
43 catch (const CORBA::Exception
&e
)
45 e
._tao_print_exception ("Exception caught from ORB::run:");
49 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("ERROR unknown exception caught ")
50 ACE_TEXT ("from ORB::run\n")));
58 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
62 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
64 ACE_Get_Opt
opts (argc
, argv
, ACE_TEXT ("s:c:"));
65 const ACE_TCHAR
*server
= 0, *client
= 0;
66 for (int o
; (o
= opts ()) != -1;)
71 server
= opts
.opt_arg ();
74 client
= opts
.opt_arg ();
84 CORBA::Object_var obj
= orb
->resolve_initial_references ("RootPOA");
85 PortableServer::POA_var poa
= PortableServer::POA::_narrow (obj
);
86 PortableServer::POAManager_var pm
= poa
->the_POAManager ();
88 Test::Hello_var srv_obj
= srv
._this ();
89 CORBA::String_var srv_str
= orb
->object_to_string (srv_obj
);
90 FILE *f
= ACE_OS::fopen (server
, "w");
91 ACE_OS::fputs (srv_str
, f
);
99 ACE_CString
ior ("file://");
100 ior
+= ACE_TEXT_ALWAYS_CHAR (client
);
101 CORBA::Object_var obj
= orb
->string_to_object (ior
.c_str ());
102 Test::Hello_var hello
= Test::Hello::_narrow (obj
);
103 CORBA::String_var str
= hello
->get_string ();
104 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("(%P|%t) - returned <%C>\n"),
116 catch (const CORBA::Exception
&e
)
118 e
._tao_print_exception ("Exception caught:");
122 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("ERROR unknown exception ")
123 ACE_TEXT ("caught in main\n")));