On 4/7/11 3:56 AM, oğuz kaan başal wrote:
Hi, I wanna make an app server/client context and I wanna send to the server
a message like
Hi,
"BROADCAST " + SerializableObject

if its possible can you explain how can I do that or can you give me any
suggestion about sending Serialized Object without any conclusion sendng
only text message.
This is obviously possible, but you will have to decode yourself the message, as you are mixing text and binary content.

It's not really a big deal though. The main issue is that you will have to deal with data fragmentation, which means you must be able to cumulate the full message before being able to decode it (remember that TCP does not guarantee that you will receive your message in one single fragment).

The best is to slightly modify your message, adding some data about the full message size :

size / "BROADCAST" / serialized object

Or, if your text message is just a know verb, something like :
"BROADCAST" / object size / serialized object

Using a cumulative decoder, you'll be able to know when to stop grabbing bytes and start the deserialization of the serialized object, because you now its size.

I suggest you follow the sample provided in http://mina.apache.org/chapter-11-codec-filter.html if you want to implement such a decoder.

Hope it helps.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to