[omniORB] Two Servers, One Client

Johan Cronje jcronje at dsp.sun.ac.za
Wed Nov 12 13:09:56 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there again

I am having trouble finding examples for solving my current problem.
Basically, the setup is as follows:

I have a single servant implementation that I want to run on two computers.
I have a client that must communicate with both these servants, using the 
Naming service to obtain object references.

I have set up my nameservice as follows:
On one machine, I have my servant bound to the root context as follows:

   root
     |
   subcontroller (id)  sdr (kind)
     |
    jjc (id)  michelle (kind)


And on the other machine I have:


   root
     |
   subcontroller (id)  sdr (kind)
     |
    jjc (id)  fee (kind)


I did it like this because I can't see how else to distinguish between the two 
servants.

My relevant client code is:

sdr_corba_helper help_me; // class that contains get_obj_ref() method

const char* options[] [2] =  
{{"InitRef","NameService=corbaname::michelle.dsp.sun.ac.za:"},
 {"InitRef","NameService=corbaname::fee.dsp.sun.ac.za:"},
 {0,0}};  // setup nameservice

CORBA::ORB_var orb1 = CORBA::ORB_init(argc, argv,"omniORB4",options);

CORBA::Object_var obj1 = help_me.get_obj_ref(orb1,"jjc","fee");

CORBA::Object_var obj2 = help_me.get_obj_ref(orb1,"jjc","michelle");

sdr_base_classes::sdr_subcontroller_base_var objref1 = 
   sdr_base_classes::sdr_subcontroller_base::_narrow(obj1);

sdr_base_classes::sdr_subcontroller_base_var objref2 = 
   sdr_base_classes::sdr_subcontroller_base::_narrow(obj2);


However, I think I understand nameservice setup incorrectly...
What happens is this:

I have the servants running on both machines, however when I run the client,
as soon as I want to invoke an operation on objref2, I get a
TRANSIENT_ConnectFailed exception. (operations on objref1 works fine).
If I change 

  sdr_base_classes::sdr_subcontroller_base_var objref2 = 
     sdr_base_classes::sdr_subcontroller_base::_narrow(obj2);

to

  sdr_base_classes::sdr_subcontroller_base_var objref2 = 
     sdr_base_classes::sdr_subcontroller_base::_narrow(obj1);


operations on objref2 run fine also. Note that both servants _are_ running.

What am I doing wrong? Is this the correct way to identify the wanted servant
if it runs on two or more machines? Also, if I use the options array as above,
does it override or complement the setup in omniORB.cfg?

Thank you very much

Johan
- -- 
"There is beauty in simplicity"		-- Johan Cronje
- ---------------------------------------------------------------
Johan Cronje
Digital Signal Processing / Telecommunications Group
Electrical and Electronic Engineering Department
University of Stellenbosch
http://www.dsp.sun.ac.za/~jcronje
- ---------------------------------------------------------------
GNUPG Key: http://www.dsp.sun.ac.za/~jcronje/jcronje.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iQEVAwUBP7IVB+EeclgONaRbAQJkqgf/Q0vcMudBrrVvK+bj1liyiah3jUw5ir4f
clMAHE2W5dNsdZHORU7/LQLusL7qgdyLGznw4Ezbz2ij7DF4H77gOJEwQTunef7G
jvyou4X1MuQX67OtyusYI7TedWQfFj71cjvDrkEP0Qhk2Id4mKBh8ZFz4FklZhhp
ixNkgoEBP7H48rNGDUxTzt+QZaLR59TGA3Hq4isdl8QcqJgpouQBq2CycLM6KFH9
evQAOlX+6I81XDIKpl0T9EwYk35XYMKbzT4GnmVYuqMHzEyMOWC3rmQtvmdYr8Ni
r5q/cB10/71xQYnfQl0ibU9vBRrvfFpzrzHqivIDj2goYooe5SIeSQ==
=+z4S
-----END PGP SIGNATURE-----




More information about the omniORB-list mailing list