netty read part of the messages when the client write 1 command/ms ?
MCYang
zjuyyl at gmail.com
Wed Jun 2 07:41:21 EDT 2010
thanks,christian, now the decoder works perfectly!
2010/6/2 christian [via Netty Forums and Mailing Lists] <
ml-node+5128187-1179544985-549976 at n2.nabble.com<ml-node%2B5128187-1179544985-549976 at n2.nabble.com>
>
> Hi,
>
> this is called "packet fragmentation" and should be expected (i.e. it
> is normal TCP behaviour and not a Netty bug). Trustin did write some
> very good documentation about this in the Javadoc,
> see here:
>
>
> http://docs.jboss.org/netty/3.1/api/org/jboss/netty/handler/codec/frame/FrameDecoder.html
>
> regards,
> christian!
>
> On Mon, May 31, 2010 at 4:41 PM, MCYang <[hidden email]<http://user/SendEmail.jtp?type=node&node=5128187&i=0>>
> wrote:
>
> >
> > I try to bechmark my socket app.
> > client do
> >
> > setInterval the follow command to 1ms
> >
> > socket.writeInt(bytes.length);
> > socket.writeBytes(bytes);
> > socket.flush();
> >
> >
> > server do
> >
> > decode
> > ChannelBuffer bf = (ChannelBuffer)buffer;
> > int remaining = bf.readableBytes();
> > int total = remaining;
> > while(remaining>=4){
> > len = bf.getInt(total-remaining);
> > remaining = remaining-4;
> > if(remaining>=len){
> > bt = new byte[len];
> > bf.getBytes(total-remaining, bt);
> > remaining = remaining-len;
> > }else {//here remaining<len,it means that some message isn't in
> this
> > channelBuffer but int the next ChannelBuffer, is it a bug,or how can I
> fix
> > it in this situation?
> >
> > bt = new byte[len];
> > bf.getBytes(total-remaining, bt,0,remaining);
> > break;
> > }
> >
> > }
> > --
> > View this message in context:
> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/netty-read-part-of-the-messages-when-the-client-write-1-command-ms-tp5122037p5122037.html
> > Sent from the Netty User Group mailing list archive at Nabble.com.
> > _______________________________________________
> > netty-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5128187&i=1>
> > https://lists.jboss.org/mailman/listinfo/netty-users
> >
>
> _______________________________________________
> netty-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5128187&i=2>
> https://lists.jboss.org/mailman/listinfo/netty-users
>
> ------------------------------
> View message @
> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/netty-read-part-of-the-messages-when-the-client-write-1-command-ms-tp5122037p5128187.html
> To unsubscribe from netty read part of the messages when the client write 1
> command/ms ?, click here<http://netty-forums-and-mailing-lists.685743.n2.nabble.com/subscriptions/Unsubscribe.jtp?code=emp1eXlsQGdtYWlsLmNvbXw1MTIyMDM3fC0yMDAwNzYyMzM2>.
>
>
>
--
best regards,
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/netty-read-part-of-the-messages-when-the-client-write-1-command-ms-tp5122037p5130346.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list