Hi Caius, do you use string in ConfigRC? Try using TString instead if possible. That should work. Cheers, Fons. Caius Howcroft wrote: > > Hi, > I'm having some problems using root to send objects over a > network. > I have made a TOject called ConfigRC and I am sending it a la the > users guide, the code for the client and server are below. The class > ConfigRC has a member function GetIP which when called returns the value > of a privite member of the class( string IP). There are no complaints when > I compile > or run. However when I recieve the object and "GetIP" I find that in the > newly created object the privite variables (in this case "strinf IP;") are > not set. > > The default constructor of ConfigRC is just void. So my question is, how > do I send an object contents so I can then use the oject again on another > machine? > > Any help is much appreciated. > > Thanks > Caius Howcroft > > SERVER: > char* FileName="config.dat"; > ConfigRC *FromFile = new ConfigRC( FileName ); > while (1) { > TServerSocket *ss = new TServerSocket(9090, kTRUE); > TSocket *sock = ss->Accept(); > cout << "SERVER:The Socket was accepted" << endl; > TMessage message(kMESS_OBJECT); > message.WriteObject(FromFile); > sock->Send( message );; > ss->Close(); > } > > CLIENT: > TSocket *sock = new TSocket("localhost", 9090); > string IPname = "IP_BRP3"; > string IPadd; > while (1) > { > TMessage *message; > sock->Recv(message); > ConfigRC *FromFile = (ConfigRC*)message->ReadObject(message->GetClass()); > delete message; > IPadd = FromFile->GetIP( IPname ); > } > sock->Close(); > > > ______________________ > CAIUS HOWCROFT > 01223 711 788 UK > 07977 473 937 UK(mobile) -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:34 MET