[prev in list] [next in list] [prev in thread] [next in thread] 

List:       omniorb-list
Subject:    Re: [omniORB] Problems registering names in omniORB
From:       Duncan Grisby <duncan () grisby ! org>
Date:       2007-01-14 14:16:14
Message-ID: E1H669T-0005RO-ID () apasphere ! com
[Download RAW message or body]

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@grisby.org     --
   -- http://www.grisby.org --

_______________________________________________
omniORB-list mailing list
omniORB-list@omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic