1 #include "Messenger_i.h"
8 const char* server_ior_file
= "server.ior";
11 void write_ior(const char* ior
) {
12 std::ofstream
out(server_ior_file
);
16 int ACE_TMAIN (int ac
, ACE_TCHAR
* av
[])
20 CORBA::ORB_var orb
= CORBA::ORB_init(ac
, av
);
22 NodeFactory::register_new_factory(* orb
.in());
23 BoxedValueFactory::register_new_factory(* orb
.in());
24 BaseValueFactory::register_new_factory(* orb
.in());
25 TValueFactory::register_new_factory(* orb
.in());
26 ConfigValueFactory::register_new_factory(* orb
.in());
28 CORBA::Object_var obj
= orb
->resolve_initial_references("RootPOA");
29 PortableServer::POA_var poa
= PortableServer::POA::_narrow(obj
.in());
31 PortableServer::POAManager_var poaman
= poa
->the_POAManager();
33 PortableServer::Servant_var
<Messenger_i
> svt
= new Messenger_i
;
35 PortableServer::ObjectId_var id
= poa
->activate_object(svt
.in());
36 obj
= poa
->id_to_reference(id
.in());
37 CORBA::String_var ior
= orb
->object_to_string(obj
.in());
40 std::cout
<< "Starting server." << std::endl
;
46 poa
->destroy(true, true);
49 catch (const CORBA::Exception
& ex
)
51 ex
._tao_print_exception ("Exception caught:");