[omniORB] What's wrong in this code?

Sai-Lai Lo s.lo@uk.research.att.com
Tue, 29 May 2001 10:29:31 -0000


The information you supplied so far does not point to anything obviously
wrong that can explain your problem. Personally I will not touch Redhat 7.0
with all the known problems with compiler and runtime.

In order to get help, it is useful to supply more information than you have
done so far. For instance, why not turn up the omniORB trace level to
something like 40? The ORB will dump all the messages it send and receive.
At least that will give you some clue whether the server has receive the
request but never dispatch the call to your application or something else
has happened.



----- Original Message -----
From: "mmiguel" <mmiguel@arrakis.es>
To: <omniorb-list@uk.research.att.com>
Sent: Sunday, May 27, 2001 2:40 PM
Subject: [omniORB] What's wrong in this code?




Hi!!

Please look at this piece of code...



#include ...


Servidores::SS_ElemSim_var servSim;
ElementoSimulacionImpl* elemSim;
// derived from POA_ElemSim::ES_SSimElemSim
ES_SSimElemSimImpl* eSSimElemSim;
unsigned long elemSimID;


void Aplicacion(void *info);


int main(int argc, char** argv)
{

   try
   {
      CORBA::ORB_var orb;
      PortableServer::POA_var poa;

      orb = CORBA::ORB_init(argc,argv,"omniORB3");
      CORBA::Object_var poaobj = orb->resolve_initial_references
("RootPOA");
      poa = PortableServer::POA::_narrow(poaobj);

      // Gets 'servSim' reference from the Naming Service...
      CORBA::Object_var obj = getObjectReference
(orb,"test","my_context","ss_es");

      servSim = Servidores::SS_ElemSim::_narrow
(obj);


      elemSim = new ElementoSimulacionImpl(/* Constructor parameters...
*/);

      /* Methods from 'eSSimElemSim' just call other methods
from 'elemSim' */
      eSSimElemSim = new ES_SSimElemSimImpl(elemSim);

      PortableServer::ObjectId_var oid_sm_sg = poa->activate_object
(eSSimElemSim);

      PortableServer::POAManager_var mgr = poa->the_POAManager();
      mgr->activate();

      omni_thread::create(Aplicacion,NULL);

      orb->run();

      poa->destroy(true,true);
      orb->destroy();


      eSSimElemSim->_remove_ref();
      return 0;

   }
   catch (...)
   { cerr << "Exception!!\n";}

   return 0;

}


void Aplicacion(void *info)
{
   try


      /* Gives to 'servSim' its reference (ES_SSimElemSim_ptr)
        (Others processes will get the reference from 'servSim') */
      elemSimID = servSim->Register(eSSimElemSim->_this());

      while (1)


         omni_thread::sleep(5);


         elemSim->updateSomethingLocal(...);
         servSim->tellThatSomethingHasBeenUpdated(...);
      }

   }
   catch (...)
   { cerr << "Exception!!\n"; }

}



The problem is that ANYBODY can't communicate with the 'eSSimElemSim'
object
(even 'servSim' can't do it).
When anyone tries to invoke any method from 'eSSimElemSim', blocks and
there is no
error message in the screen (just blocks forever).
This happens only in Linux (at least in my Red Hat 7) (in WindowsME
everything works OK).
At first I thought I was registering the object in a wrong way in the
POA, but if
it works in Windows... Perhaps there's any problem with the ports or
sockets or
something related in Linux (?¿?¿?¿)


Thank you for your attention...

Bye!!