[omniORB] How to check if server exists ?

Sai-Lai Lo S.Lo@uk.research.att.com
04 Feb 2000 11:26:14 +0000


Isn't it nice to have the source so that you can do something not possible
with the public API :-)

Seriously, I think in the long run we will have to provide an API to allow
the application to populate the references returned by
resolve_initial_references.  I'll add this to my to-do list.

Sai-Lai



>>>>> Ulf Meyer writes:

> I used the following code to avoid using the parameters in ORB_init. This also allows me to connect to multiple Name Services in my application:
> (using omniORB 2.8.0)
> -----------------------------------------------------------------
> #include <omniORB\src\lib\omniORB2\bootstrap_i.h>
> ...
>  omniInitialReferences* oir = omniInitialReferences::singleton();
>  oir = omniInitialReferences::singleton();
oir-> initialise_bootstrap_agent( m_Hostname, (short) m_Port );
oir-> set("NameService", NULL);

>  // contact name service try { // Obtain a reference to the root context
>  of the Name service: CORBA::Object_var initServ; initServ =
>  m_ORB->resolve_initial_references("NameService"); > ...  > and so on >
>  --------------------------------------------------------------------- >
>  This is, of course, omniORB-specific. The call
>  "oir->set("NameService",NULL)" is needed because omniInitialReferences
>  keeps a map (Servicename -> IOR), so after the NameService IOR > is
>  first obtained via a remote call, all following calls to
>  resolve_initial_references only return this first IOR. If you change the
>  Hostname/Port configuration, the above call > forces
>  omniInitalReferences to get a "new" NameService IOR via remote call with
>  the new host/port configuration.

> Ulf
> --

> datafactory - Gesellschaft fuer Informationssysteme mbH
> Stoehrerstr. 17                   Tel. +49(341)24495- 0
> 04347 Leipzig                     Fax. +49(341)24495-25
> http://www.datafactory.de      mailto:um@datafactory.de






-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND