[omniORB] What's wrong in this code?

mmiguel mmiguel@arrakis.es
Sun, 27 May 2001 14:40:14 GMT



Hi!!

Please look at this piece of code=2E=2E=2E



=23include =2E=2E=2E


Servidores=3A=3ASS=5FElemSim=5Fvar servSim=3B
ElementoSimulacionImpl* elemSim=3B   =

// derived from POA=5FElemSim=3A=3AES=5FSSimElemSim
ES=5FSSimElemSimImpl* eSSimElemSim=3B    =

unsigned long elemSimID=3B


void Aplicacion(void *info)=3B


int main(int argc=2C char** argv)
=7B

   try
   =7B
      CORBA=3A=3AORB=5Fvar orb=3B
      PortableServer=3A=3APOA=5Fvar poa=3B

      orb =3D CORBA=3A=3AORB=5Finit(argc=2Cargv=2C=22omniORB3=22)=3B
      CORBA=3A=3AObject=5Fvar poaobj =3D orb-=3Eresolve=5Finitial=5Frefer=
ences
(=22RootPOA=22)=3B
      poa =3D PortableServer=3A=3APOA=3A=3A=5Fnarrow(poaobj)=3B

      // Gets =27servSim=27 reference from the Naming Service=2E=2E=2E
      CORBA=3A=3AObject=5Fvar obj =3D getObjectReference
(orb=2C=22test=22=2C=22my=5Fcontext=22=2C=22ss=5Fes=22)=3B
		=

      servSim =3D Servidores=3A=3ASS=5FElemSim=3A=3A=5Fnarrow
(obj)=3B                     =


      =

      elemSim =3D new ElementoSimulacionImpl(/* Constructor parameters=2E=
=2E=2E =

*/)=3B

      /* Methods from =27eSSimElemSim=27 just call other methods =

from =27elemSim=27 */
      eSSimElemSim =3D new ES=5FSSimElemSimImpl(elemSim)=3B
      =

      PortableServer=3A=3AObjectId=5Fvar oid=5Fsm=5Fsg =3D poa-=3Eactivat=
e=5Fobject
(eSSimElemSim)=3B

      PortableServer=3A=3APOAManager=5Fvar mgr =3D poa-=3Ethe=5FPOAManage=
r()=3B
      mgr-=3Eactivate()=3B

      omni=5Fthread=3A=3Acreate(Aplicacion=2CNULL)=3B

      orb-=3Erun()=3B

      poa-=3Edestroy(true=2Ctrue)=3B
      orb-=3Edestroy()=3B

                 =

      eSSimElemSim-=3E=5Fremove=5Fref()=3B =

      return 0=3B

   =7D   =

   catch (=2E=2E=2E)
   =7B cerr =3C=3C =22Exception!!=5Cn=22=3B=7D
	=

   return 0=3B

=7D


void Aplicacion(void *info)
=7B
   try
   =7B      =

      /* Gives to =27servSim=27 its reference (ES=5FSSimElemSim=5Fptr)
        (Others processes will get the reference from =27servSim=27) */
      elemSimID =3D servSim-=3ERegister(eSSimElemSim-=3E=5Fthis())=3B    =
 =

      =

      while (1)
      =7B         =

         omni=5Fthread=3A=3Asleep(5)=3B
         =

         =

         elemSim-=3EupdateSomethingLocal(=2E=2E=2E)=3B
         servSim-=3EtellThatSomethingHasBeenUpdated(=2E=2E=2E)=3B        =
 =

      =7D

   =7D
   catch (=2E=2E=2E)
   =7B cerr =3C=3C =22Exception!!=5Cn=22=3B =7D

=7D



The problem is that ANYBODY can=27t communicate with the =27eSSimElemSim=27=
 =

object
(even =27servSim=27 can=27t do it)=2E
When anyone tries to invoke any method from =27eSSimElemSim=27=2C blocks =
and =

there is no =

error message in the screen (just blocks forever)=2E =

This happens only in Linux (at least in my Red Hat 7) (in WindowsME =

everything works OK)=2E =

At first I thought I was registering the object in a wrong way in the =

POA=2C but if =

it works in Windows=2E=2E=2E Perhaps there=27s any problem with the ports=
 or =

sockets or =

something related in Linux (=3F=BF=3F=BF=3F=BF)


Thank you for your attention=2E=2E=2E

Bye!!