sending serializable object in messages

"Kan Deng" <[email protected]> Fri, 27 May 2005 03:29:23 -0700
Newsgroups gmane.network.beep.beepcore.java.general
Message-ID <[email protected]>
Hi, there,

Is it possible to send a serializable java object in message?

On the client side, I tried,

   channel.sendMSG(new ByteOutputDataStream(objectToBytes(reqObj)), reply);

in which objectToBytes() is my own implementation to convert a serializable 
object into a byte array.

On the server side,

    InputDataStream ds = message.getDataStream();
    BufferSegment b = ds.waitForNextSegment();
    byte[] reqBytes = b.getData();

    ByteArrayInputStream bain = new ByteArrayInputStream(reqBytes);
    ObjectInputStream ois = new ObjectInputStream(bain);

Unfortunately, this approach doesn't work.

I compared the objectToBytes(reqObj) on the client side with the reqBytes on 
the server side, they are different. The server side's reqBytes has 
following bytes at the beginning, before the bytes sent by the client 
appears.

  aced 0005 7572 0002 5b42 acf3 17f8 0608 54e0 0200 0078 7000 0000 7b0d 0a

Also, as a test, I send an object with 150k bytes. The server cannot receive 
all the bytes.


Can you please tell me how to work around? For example, is it possible to 
use OutputDataStreamAdapter, and how to use it?


many thanks,
Kan

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005