[ROOT] Problems with TClonesArray members over TSocket

From: Egon Pavlica (Egon.Pavlica@p-ng.si)
Date: Thu Nov 28 2002 - 17:51:35 MET


hello,

i have a strange problem. i am sending a class over network. this class 
has TClonesArray of another class. When i send the class, the members of 
the TClonesArray are mixed, but not changed. 

in details: i have a class TLRunState, which contains a pointer to 
TClonesArray of TLProgramLine class (fProgram member). class TProgramLine 
contains three Float_t variables and represents a line.
in an example of client script(copied from tutorial) i generate 
TClonesArray of two program lines, first has values 1,2 and 3
the second has values 4,5 and 6. This is seen when ->Dump(). 
{
gDebug=1;
gSystem->Load("libLRunState.so");
TSocket *sock = new TSocket("localhost", 9090);
TMessage mess(kMESS_OBJECT);
TLRunState* glrunstate=new TLRunState(2); 	
glrunstate->AddProgramLine(0,1,2,3);//first line
glrunstate->AddProgramLine(1,4,5,6);//second line
mess.WriteObject(glrunstate);   
sock->Send(mess);       
sock->Close();
glrunstate->Dump();
}

the class is send to server script

{
gSystem->Load("libLRunState.so");
gDebug=1;
TServerSocket *ss = new TServerSocket(9090, kTRUE);
TSocket *s0 = ss->Accept();
ss->Close();
TMonitor *mon = new TMonitor;
mon->Add(s0);
while (1) {
  TMessage *mess;
  TSocket  *s;
  s = mon->Select();
  s->Recv(mess);
  if (mess->What() == kMESS_OBJECT) {
    printf("got object of class: %s\n", mess->GetClass()->GetName());
    TLRunState *h = (TLRunState *)mess->ReadObject(mess->GetClass());
    h->Dump();
    delete h; 
  } 
  delete mess;
}
s0->Close();
}

but the ->Dump() is different!! first line is 1,4,2 and 2nd is 5,3,6

to compile libLRunState.so i have attached class header, source, 
linkdef and Makefile.

my system is:
AMD Athlon(tm) XP 1600+ 512RAM
linux 2.4.18-10 (based on redhat 7.3+sgi)
gcc 2.96
ldd (GNU libc) 2.2.5
ROOT 3.03/09 18 September 2002

thanks!!

-- 
------------------------------------------
Egon Pavlica e-mail:egon.pavlica@p-ng.si
Laboratory for epitaxy and nanostructures
Nova Gorica Polytechnic (www.p-ng.si)
tel.+386-5-3315-249
fax.+386-5-3315-359
------------------------------------------








This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:21 MET