[omniORB] Problems registering names in omniORB
Duncan Grisby
duncan at grisby.org
Sun Jan 14 14:16:14 GMT 2007
On Friday 12 January, Tuyen Chau wrote:
> I may have misunderstood your requirements but if you want to
> dynamically change the DefaultInitRef parameter in order to connect to
> a different omniNames, you can use the internal function
> setFromFile(). Here's how we use it to talk to differerent omniNames.
> We don't even need to specify DefaultInitRef in the registry or the
> omniORB config file.
>
> // Set up the name to find the NameService. This is actually an
> // internal call we discovered from looking around the omniORB code.
> sprintf(corbaName, "corbaname::%s", hostName);
> omni::omniInitialReferences::setFromFile("NameService", corbaName);
>
> // Obtain a reference to the root context of the Name service
> obj = orb->resolve_initial_references("NameService");
>
> // Narrow the reference returned.
> rootContext = CosNaming::NamingContext::_narrow(obj);
If you just want to contact a different naming service to the one set in
the registry or configuration file, you don't need to use any internal
omniORB functions. Just give the corbaname URI to string_to_object:
sprintf(corbaName, "corbaname::%s", hostName);
obj = orb->string_to_object(corbaName);
rootContext = CosNaming::NamingContext::_narrow(obj);
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list