sorry for not answering before. A message or any buffer send by a ROOT socket
has the following format:
length (UInt_t - 4 bytes)
what (UInt_t - 4 bytes)
n data bytes
the length is n + 4 bytes (so does not include itself, only what + n data
bytes).
All data is in network natural format (big endian). The ROOT tobuf/frombuf and
TBuffer::operator<<() and >>() perform the needed byte swapping.
Now what you put in the n data bytes is up to you. If you use ROOT to pack an
object it will be a complex byte sequence that is determined by the methods
TBuffer::WriteObject() and TBuffer::ReadObject(). The WriteObject() method
encodes the object's class name or reference id if an object of that class
is already put once in the buffer and the object data (by calling the
obj->Streamer() method) or a reference id if the same object has already
been put once in the buffer. The ReadObject() method is doing the inverse.
So to send strings or simple byte sequences using ROOT's TSocket there
should be no problem. To send objects, you will have to implement the
TBuffer class in Java (which might be a real good idea) and provide
for your Java classes compatible Streamer() methods (which should be
not too difficult when you start from the C++ version).
Let me know if you get the simple string example going. If that works
I might help you getting TBuffer implemented in Java.
Cheers, Fons.
FABIOR@FNALD.FNAL.GOV wrote:
>
> Hi rooters!
> Which is the TMessage format that a Socket expect? (I mean byte by byte) I need
> it because I want to use a ROOT server process and a Java Client, communicating
> via Socket.
>
> Thanks
>
> Fabio Rossi
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910