Text Protocol -- Variable length, variable number of lines
venky10
vsayyagari at gmail.com
Sat Nov 7 17:54:29 EST 2009
Hi,
In the telnet/server case each newline would trigger a MessageEvent. In my
case it would be inefficient, I intend to handle MessageEvent after an X
number (which is variable) of lines have been available for upstream
processing to the StreamDecoder. If I simple call --
public void messageReceived(
ChannelHandlerContext ctx, MessageEvent e) {
// Cast to a String first.
// We know it is a String because we put some codec in
TelnetPipelineFactory.
String several_lines_protocol_msg= (String) e.getMessage();
:::::
}
there is no guarantee that all the lines of the protocol packet have been
captured in
"several_lines_protocol_msg". Or is it the case that if FrameDecoder is not
supplied the message received will be all the bytes available in the stream
?
Thanks a lot.
Venkay
Trustin Lee wrote:
>
> Hi Venky,
>
> DelimiterBasedFrameDecoder is perhaps what you are looking for. Also,
> please refer to the telnet client/server example.
>
> HTH
>
> — Trustin Lee, http://gleamynode.net/
>
>
>
> On Sat, Nov 7, 2009 at 7:11 AM, venky10 <vsayyagari at gmail.com> wrote:
>>
>> Hi,
>>
>> I am a newbie to Netty.
>> I have text protocol to decode. It has variable number of lines, all
>> delimited by 'newline'.
>> There is no other end-of-frame delimiter. I am assuming it would be most
>> efficient to read the entire frame till there are no more lines to be
>> read
>> on single MessageEvent.
>>
>> What is the best approach ?
>>
>> Thanks,
>> Venky
>> --
>> View this message in context:
>> http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
--
View this message in context: http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3966051.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list