Discussion:
[omniORB] Muti-nameserver problem
Naoki Miyashita
2010-04-06 05:59:14 UTC
Permalink
hello,

I have a trouble about multi nameservers by using OmniORB.

My application(MyApp) with OmniORB intends to bind two server objects to two nameservers as follows.

Hosts:
1) MyApp : 192.168.1.10
2) Nameserver1 : 192.168.1.100:2809
3) Nameserver2 : 192.168.1.200:2809

MyApp actions are
1) Initialize ORB to Nameserver1 as follows on one thread.

try {
const char* options[][2] = { { "InitRef", "NameService=corbaname::192.168.1.100:2809" }, { 0, 0 } };
CORBA::ORB_var orb = CORBA::ORB_init(__argc, __argv, "omniORB4", options);
....................
...................

2) Initialize ORB to Nameserver2 as follows on another thread.

try {
const char* options[][2] = { { "InitRef", "NameService=corbaname::192.168.1.200:2809" }, { 0, 0 } };
CORBA::ORB_var orb = CORBA::ORB_init(__argc, __argv, "omniORB4", options);
....................
...................


I have a trouble in this 2) action.
I set the nameserver as "NameService=corbaname::192.168.1.200:2809", but the object was
bound to Nameserver1(192.168.1.100:2809).

According to my for this problem, the set information of "nameserver" seems
to be not changed until calling "orb->destory()".
I'd like to bind 2-nameserver simultaneously, Let me know how to use multi-nameserver.

Thanks.

Naoki
Luke Deller
2010-04-06 06:20:11 UTC
Permalink
Hi Naoki,

With omniORB, the CORBA::ORB object returned by CORBA::ORB_init is a singleton. If you call ORB_init a second time it will ignore the new parameters and return the same object as last time. This explains why your example behaved as it did.

If you want to communicate with two different name servers, you can do so using orb->string_to_object rather than using the "NameService" initial reference, eg:

CORBA::Object_var ns1 = orb->string_to_object("corbaname::192.168.1.100");
CORBA::Object_var ns2 = orb->string_to_object("corbaname::192.168.1.200");

(Note that the port 2809 is default so there is no need to specify it in your corbaname URL)

Regards,
Luke.

-----Original Message-----
From: omniorb-list-***@omniorb-support.com [mailto:omniorb-list-***@omniorb-support.com] On Behalf Of Naoki Miyashita
Sent: Tuesday, 6 April 2010 9:59 AM
To: omniorb-***@omniorb-support.com
Subject: [omniORB] Muti-nameserver problem

hello,

I have a trouble about multi nameservers by using OmniORB.

My application(MyApp) with OmniORB intends to bind two server objects to two nameservers as follows.

Hosts:
1) MyApp : 192.168.1.10
2) Nameserver1 : 192.168.1.100:2809
3) Nameserver2 : 192.168.1.200:2809

MyApp actions are
1) Initialize ORB to Nameserver1 as follows on one thread.

try {
const char* options[][2] = { { "InitRef", "NameService=corbaname::192.168.1.100:2809" }, { 0, 0 } };
CORBA::ORB_var orb = CORBA::ORB_init(__argc, __argv, "omniORB4", options);
...................
..................

2) Initialize ORB to Nameserver2 as follows on another thread.

try {
const char* options[][2] = { { "InitRef", "NameService=corbaname::192.168.1.200:2809" }, { 0, 0 } };
CORBA::ORB_var orb = CORBA::ORB_init(__argc, __argv, "omniORB4", options);
...................
..................


I have a trouble in this 2) action.
I set the nameserver as "NameService=corbaname::192.168.1.200:2809", but the object was
bound to Nameserver1(192.168.1.100:2809).

According to my for this problem, the set information of "nameserver" seems
to be not changed until calling "orb->destory()".
I'd like to bind 2-nameserver simultaneously, Let me know how to use multi-nameserver.

Thanks.

Naoki



_______________________________________________
omniORB-list mailing list
omniORB-***@omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
**********************************************************************************************
Important Note
This email (including any attachments) contains information which is confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, distribute or copy this email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this email are not necessarily the views of IRESS Market Technology Limited.

It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system.
IRESS Market Technology Limited does not warrant that the information is free of a virus or any other defect or error.
**********************************************************************************************
Loading...