AW: [omniORB] programmitcally start-stop naming server

Fischer, Clemens clemens.fischer at atlas-elektronik.com
Thu Sep 27 17:34:32 BST 2007


Hi Kent,

your server might be located by clients in several other ways, without the need of a naming service. The problem is always: how does the client get a reference to the server's object?

A very simply way is to get an IOR string of the object reference by calling object_to_string, write that string to a file which can be read by a client. The client may then get the IOR string back from the file and call string_to_object to create the object stub.

A smarter solution would be to make the server locatable by a corbaloc URI, i.e. a string of the form "corbaloc:iiop:<host>:<port>/<objectkey>". Here the object reference is persistent, which means it is always the same and thus well-known to the client (and therefore does not need to be retrieved from a naming service or IOR file).

Read chapter 6 "Interoperable Naming Service" of the omniORB user's guide to learn more about this feature.

Clemens


-----Ursprüngliche Nachricht-----
Von: omniorb-list-bounces at omniorb-support.com [mailto:omniorb-list-bounces at omniorb-support.com] Im Auftrag von Kent Gibson
Gesendet: Donnerstag, 27. September 2007 14:34
An: omniorb-list at omniorb-support.com
Betreff: [omniORB] programmitcally start-stop naming server

Is there any way that I can start and stop the naming
service (omniNames) programmatically?

Or can I somehow do without the naming service? and if
so how?

What I want to do is start everything up in one
windows dll. And then hopefully also shut everything
down in one dll.

This is what I am doing now:

orb = CORBA::ORB_init(x, &test); 
CORBA::Object_var obj =
orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow(obj); 
Echo_i* myecho = new Echo_i(); 
PortableServer::ObjectId_var myechoid =
poa->activate_object(myecho);
// Obtain a reference to the object, and register it
in  
// the naming service. 
obj = myecho->_this();  
CORBA::String_var x;
x = orb->object_to_string(obj); 
cout << x << endl;  
if( !bindObjectToName(orb, obj) )
{
	return "unable to bind";
}
		
myecho->_remove_ref();
PortableServer::POAManager_var pman =
poa->the_POAManager();
pman->activate();  
orb->run();  

Any help would be grand.

thanks.




      ____________________________________________________________________________________
Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.
http://tv.yahoo.com/ 


_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list



More information about the omniORB-list mailing list