Sending TClonesArray over network

Alexander Zvyagin (zvyagin@mx.ihep.su)
Sat, 16 May 1998 22:53:09 GMT+03:00


IHEP, Protvino, Russia, 16-MAY-1998

Dear friends!

I have problem in sending TClonesArray from server to client program over
network. (I try to write code that is analogus to hserv.C hclient.C)

The part of code that sends data:
---------------------
TClonesArray events("EVENT",11,kFALSE);
new(events[0]) EVENT;
TMessage message(kMESS_OBJECT);
message.Reset(); // re-use TMessage object
message.WriteObject(&events); // write object in message buffer
socket_client->Send(message); // send message
events.Clear();
----------------------------

The part of code that receives data:
------------------------------
TMessage *message;
socket.Recv(message) )
if( message->What()==kMESS_OBJECT )
{
TClonesArray *o = (TClonesArray*) message->ReadObject(message->GetClass());
delete o;
}
delete message;
------------------------------

The last code crashes at line
TClonesArray *o = (TClonesArray*) message->ReadObject(message->GetClass());

with diagnostic:

Fatal in <operator delete>: unreasonable size (137160120)
aborting
Abort

What am I doing wrong?

Thanks in advance,
Alexander Zvyagin.