<br>
<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>> Then, discconect the network card of PC A, and start process<br>> A. This process, every 3 seconds test its TCP conection
<br>> trying to ping the IP where omninames is running. If the test<br>> success (when I reconnect the network card), creates a thread<br>> that goes into orb->run(), and (in another thread) poll the process B.
<br><br>I assume that when process A calls the service in B, it passses in an object reference to a servant in process A, right ? Have a look at that object reference - I think that you will see that the object reference contains an IP address which is localhost.
</blockquote>
<div> </div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">This is because when you started up process A I assume that you initialized the orb before you begin checking for the presence of the network
</blockquote></div>
<div><br>Firstly I did what you said, but then I saw the local reference so I change it. I've only start the thread that goes into orb-run() if I have TCP connection and if the PC in which omninames are running is reachable. It is what I meant when I said "if the test success".
</div>
<div> </div>
<div>
<div> </div>
<div> </div>
<div>>If my guesses are correct the problem should be avoidable by either setting a static IP address of the machine >containing process A (the machine address is then visible to the orb even when the network is down)
</div>
<div> </div>
<div>Every PC I use have static IP (only one network card, and only one IP).</div>
<div> </div>
<div>Each time I discconect and connect the network while the process are running the port used is different, but I think this have no importance, right</div>
<div> </div>
<div>Is there some way to me of seeing what's happening since proccess A invoques a method of process B until it reachs the code implementation in proccess B? I have look the ORB traces, but I don't really understand it.
</div>
<div> </div>
<div>The code to do this is:</div></div>
<div>
<div>For process A</div>
<div> if(ping.Ping("<a href="http://192.168.2.114">192.168.2.114</a>"))<br> {<br> hThreadCorba = CreateThread (NULL, NULL, ServerResponse, NULL, 0, NULL);<br> }<br> else<br> SetTimer(TIMER_CORBA,3003,NULL);
</div></div>
<div> </div>
<div>For process B</div>
<div> if(ping.Ping("<a href="http://192.168.2.114">192.168.2.114</a>"))<br> {<br> hThreadCorba = CreateThread (NULL, NULL, HiloCorba, NULL, 0, );<br> }<br> else<br> SetTimer(TIMER_CORBA,3003,NULL);
</div>
<div> </div>
<div><a href="http://192.168.2.114">192.168.2.114</a> is the static IP of the PC where omninames are running.</div>
<div> </div>
<div>Each time a process want something of the other creates a variable:</div>
<div>
<p> try<br> { <br> ProcessA m_corbaCallOb;<br> m_corbaCallOb.methodB();<br> }<br> catch(CORBA::TRANSIENT& ex)<br> {<br> }<br> catch(...)<br> {<br> }<br></p>
<p> </p>
<p>And finally, the constructor of ProcessA (is the same to proccess B, changing the name of the class and the name used by the CORBA server when binding to the name server)</p>
<p>CProcessA::CProcessA ()<br>{<br> try {<br> //------------------------------------------------------------------------<br> // Initialize ORB object.<br> //------------------------------------------------------------------------
<br> int argc=0; // Dummy variables to support following call.<br> char** argv=0;<br> CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);<br>
<br> //------------------------------------------------------------------------<br> // Bind ORB object to name service object.<br> // (Reference to Name service root context.)<br> //------------------------------------------------------------------------
<br> CORBA::Object_var obj = orb->resolve_initial_references("NameService");<br> assert (!CORBA::is_nil(obj.in()));</p>
<p> <br> //------------------------------------------------------------------------<br> // Narrow this to the naming context (Narrowed reference to root context.)
<br> //------------------------------------------------------------------------<br> CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow(obj.in());<br> assert (!CORBA::is_nil(nc.in()));<br>
<br> //------------------------------------------------------------------------<br> // The "name text" put forth by CORBA server in name service.<br> // This same name ("DataServiceName1") is used by the CORBA server when
<br> // binding to the name server (CosNaming::Name).<br> //------------------------------------------------------------------------<br> CosNaming::Name _corbaCosName;<br> _corbaCosName.length(1);</p>
<p> char str[100] = "DispatcherService"; <br> _corbaCosName[0].id=CORBA::string_dup((const char*)str);<br> <br> //------------------------------------------------------------------------
<br> // Resolve "name text" identifier to an object reference.<br> //------------------------------------------------------------------------<br> CORBA::Object_var obj1 = nc->resolve(_corbaCosName);<br>
assert(!CORBA::is_nil(obj1.in()));<br> <br> m_ObjCall = ProcessA ::_narrow(obj1.in());<br> if (CORBA::is_nil(m_ObjCall.in()))<br>
{<br> cerr << "IOR is not an SA object reference." << endl;<br> }<br> }</p>
<p> catch(CORBA::COMM_FAILURE& ex) {<br> cerr << "Caught system exception COMM_FAILURE -- unable to contact the "<br> << "object." << endl;<br> throw DS_ServerConnectionException();
<br> return;<br> }<br> catch(CORBA::SystemException& ) {<br> cerr << "Caught a CORBA::SystemException." << endl;<br> throw DS_SystemException();<br> return;<br> }<br> catch(CORBA::Exception& ) {
<br> cerr << "Caught CORBA::Exception." << endl;<br> throw DS_Exception();<br> return;<br> }<br> catch(omniORB::fatalException& fe) {<br> cerr << "Caught omniORB::fatalException:" << endl;
<br> cerr << " file: " << fe.file() << endl;<br> cerr << " line: " << fe.line() << endl;<br> cerr << " mesg: " << fe.errmsg() << endl;
<br> throw DS_FatalException();<br> return;<br> }<br> catch(...) {<br> cerr << "Caught unknown exception." << endl;<br> throw DS_Exception();<br> return;<br> }</p></div>
<div> </div>
<div> </div>
<div> </div>
<div>Thanks</div>
<div> </div>