DelimiterBasedFrameDecoder sending 0 length message
"이희승 (Trustin Lee)"
trustin at gmail.com
Thu Jun 24 04:27:02 EDT 2010
i need to know:
1) what the 'separator' is
2) what the received data is
On 06/24/2010 02:35 PM, Murali Mohan Rath wrote:
>
> Thanks Trustin.
>
> I have upgraded to 3.2.1 and I am sure that I am getting a zero length
> response.
>
> Here is the code for initializing DelimiterBasedFrameDecoder.
>
>
> byte[] delimiters = new byte[1];
> delimiters[0] = <Some seperator byte>;
> decoder = new DelimiterBasedFrameDecoder(4000, true,
> ChannelBuffers.wrappedBuffer(delimiters));
>
>
> Currently I am checking for zero length as below.
>
> @Override
> public void messageReceived(
> ChannelHandlerContext ctx, MessageEvent e) {
>
> logger.debug("Received message [{}]", e.getMessage());
> Channel channel = e.getChannel();
> ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
> int messageLength = buffer.readableBytes();
> if (messageLength == 0) return;
> byte message[] = new byte[messageLength];
> buffer.getBytes(0, message);
> logger.debug("Received message [{}]", new String(message));
>
> responseHandler.handleResponse(message);
> }
>
>
--
what we call human nature in actuality is human habit
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100624/b4a81436/attachment.bin
More information about the netty-users
mailing list