[omniORB] Connecting to a OmniORB server
Duncan Grisby
duncan@grisby.org
Wed Jun 5 23:00:01 2002
On Thursday 30 May, Alexander Deruwe wrote:
> I'm creating a CORBA server that maps database tables to objects so the
> client program doesn't need to do database stuff. I've been coding and
> testing for a few weeks on localhost, so I do stuff like this for
> connecting to the server:
>
> nameservice_obj = orb.resolve_initial_references("NameService")
That connects to the NameService that is configured in the omniORB
configuration file (or on the command line). The configured service
need not be on localhost.
> How would I code this for a remote server? I've tried (from
> http://omniorb.sourceforge.net/omni30/omniORB/omniORB004.html):
The best way is to put the URI for the remote server in the omniORB
configuration file.
> nameservice_obj = orb.resolve_initial_references("corbaloc:rir:/NameService")
corbaloc and corbaname URIs should be given to orb.string_to_object,
not resolve_initial_references.
The :rir: bit means get the result from resolve_initial_references, so
these two lines of code have exactly the same effect:
obj = orb.resolve_initial_references("NameService")
obj = orb.string_to_object("corbaloc:rir:/NameService")
You could refer to a specific name service on a specific machine with
obj = orb.string_to_object("corbaname::my.host.name")
but it is far better to use the configuration file.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan@grisby.org --
-- http://www.grisby.org --