Sending a TGraph object via network

Hello

I’m trying to send a TGraph object via network.
I copied the example from the users guide (chapter 20-Networking) and replaced the histogram class with TGraph

Client side:

TSocket socket =new TSocket(“xxx.yyy.zzz.qqq”, 9090);
char str[32];
socket->Recv(str,32);
TGraph
hpx = new TGraph(k_podatke->grLen,k_podatke->x,k_podatke->y);

TMessage message(kMESS_OBJECT);
message.WriteObject(hpx);
socket->Send(message);
socket->Close();

Server side:

TServerSocket *ss =new TServerSocket(9090, kTRUE);
TSocket *socket = ss->Accept();
socket->Send(“go”);
while (1)
{
TMessage *message;
socket->Recv(message);
***TGraph h =(TGraph)message->ReadObject(message->GetClass());
delete message;
}
socket->Close();

Root doesnt seem to like the line marked with ***. It says: “Illegal pointer to class object message…”

Any help would be greatly apreciated. :laughing:

Could you send the shortest possible client.C and server.C reproducing the problem?

Rene

The root of the problem seems to be in this lines when receiving the object

TMessage *message;
socket->Recv(message);
TGraph h =(TGraph)message->ReadObject(message->GetClass());

The only thing that is different from the example in the users guide is that the example sends a histogram instead of a graph:

TH1F h =(TH1F)message->ReadObject(message->GetClass());

I need a short but running example
showing your problem. I cannot reproduce this problem.
Could it be that in your reader, you simply forgot to link with libGraf?

Rene