[Beepcore-java-users] sending serializable object in messages
Status: Beta
Brought to you by:
huston
From: Kan D. <kan...@ho...> - 2005-05-27 10:29:35
|
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 |