mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maarten Bosteels" <mbosteels....@gmail.com>
Subject Re: Problem sending message length in ByteBuffer
Date Thu, 06 Dec 2007 10:45:00 GMT
Hi Guttikonda,

I have added a PrefixedStringCodecFactory to the trunk.
If you're using MINA 1.x, it should be easy to port.

Maarten

On Dec 4, 2007 7:26 PM, Niklas Therning <niklas@trillian.se> wrote:
> guttikonda wrote:
> > Thanks for all the suggestions.I tried using ByteArrayInputStream and it
> > worked.
> > ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > DataOutputStream writer = new DataOutputStream(baos);
> > writer.writeUTF(msg);
> > session.write(ByteBuffer.wrap(baos.toByteArray());
> >
> > AND, about the quote saying that "the network layer may decide to deliver
> > your message in several packets. The result is that you cannot assume
> > that a ByteBuffer passed in to your IoHandler.messageReceived() method
> > contains a complete message".Is it always or when using
> > ByteBuffer.getPrefixedString(...) method only? Please help.
> >
>
> This is always the case. Please have a look at the Protocol Codec tutorial:
>
> http://mina.apache.org/tutorial-on-protocolcodecfilter.html
>
> and the Reverser and SumUp examples:
>
> http://mina.apache.org/documentation.html#Documentation-Examples
>
> /Niklas
>
>

Mime
View raw message