Re: Sending TClonesArray over network

Judith Katzy (katzy@nanalpc.phy.uic.edu)
Mon, 18 May 1998 09:45:56 -0500 (CDT)


Dear Alexander,

There was a bug in the code in case a message contains objects of different
classes.
This has been fixed by Fons for the new version (VERSION 2.00/06).

cheers,
Judith

On Sat, 16 May 1998, Alexander Zvyagin wrote:

> 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.
>