Re: Using the Object in the server



Hi Michael,

I thought the same, but I cannot figure out how the pointer ha to look like.
Here is my comlpete server. I don't know who to write the function "update"
right.
I think it is somehow wrong to use the transporter-variable.

#include "transp-impl.h"
#include "stdio.h"
#include "pthread.h"


 CORBA_ORB                 orb;
 CORBA_Environment*        ev;
 PortableServer_ObjectId*  oid;
 Transporter               transporter;
 PortableServer_POA        root_poa;
 PortableServer_POAManager pm;
 CORBA_char*               objref;

 pthread_t tid;
 void *arg;
 int ps,pj;

void* update(void *arg){

  fflush(stdout);
  while(1){
    transporter->status.status="rrrr";
  }

  return;
  }


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

   FILE *                    ofp;

   ev = g_new0(CORBA_Environment,1);

   CORBA_exception_init(ev);

   orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", ev);
   /* Handle exception somehow */
   root_poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(orb,
"RootPOA", ev);
   /* Handle exception somehow */

   transporter = impl_Transporter__create(root_poa, ev);

   /* Handle exception somehow */

   objref = CORBA_ORB_object_to_string(orb, transporter, ev);
   /* Handle exception somehow */
   fprintf(stderr, "%s\n", objref);

   ofp = fopen("transp.ior","w");

   fprintf(ofp,"%s", objref);
   fclose(ofp);


   pm = PortableServer_POA__get_the_POAManager(root_poa, ev);
   /* Handle exception somehow */
   PortableServer_POAManager_activate(pm, ev);

   pthread_create(&tid, NULL, update, arg);

   /* Handle exception somehow */
   CORBA_ORB_run(orb, ev);
   return 0;
 }


Michael Meeks wrote:

> Hi Sadi,
>
> On Tue, 24 Jul 2001, Sadi Yigit wrote:
> > but I don't want to use a CORBA-function, though I want to change the
> > data of the object on the server side (the server does the changes),
> > so I would need something like:
> >
> >  Calculator->status = "rrr" (but this is not working).
>
>         If the code that is in the server wants to set a field on another
> structure in the server: what is the problem ? simply pass a pointer to
> your internal structure to wherever the code is - and set the value.
>
>         If you're inside the server you have access to your servant, which
> can contain whatever fields you please.
>
>         Regards,
>
>                 Michael.
>
> --
>  mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot
>
> _______________________________________________
> orbit-list mailing list
> orbit-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/orbit-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]