netty read part of the messages when the client write 1 command/ms ?

MCYang zjuyyl at gmail.com
Mon May 31 10:41:59 EDT 2010


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.


More information about the netty-users mailing list