ChannelBuffer and messageReceived
nixter
smp.nix at gmail.com
Fri Dec 26 17:09:03 EST 2008
Hello,
I have a writed a client/server program.
The client send data assembled in ChannelBuffer, the data look like this :
Sender, receiver, tag, DATA
Where sender, receiver, tag are integer and datas are a set of bytes.
the client send data like this :
channel.write(ChannelBuffers.wrappedBuffer(buffer)); where buffer is a
BufferByte.
In server side, to gather datas I do like this :
public synchronized void messageReceived(ChannelHandlerContext ctx,
MessageEvent e) {
ByteBuffer buff = null;
ChannelBuffer chanbuf = (ChannelBuffer) e.getMessage();
buff=chanbuf.toByteBuffer();
int src=buff.getInt();
int dest=buff.getInt();
int tag=buff.getInt();
...
}
The problème is for small buffer i got the correct data, but for some buffer
i receive wrong data!! I know because communication are non-bloquant.
My question is : when netty call messageReceived () is the ChannelBuffer
contains the whole data?
is there a mecansime like ByteBuffer.hasremaining to read the whole data
sent?
Please help if you have an idea or an example.
P.S sorry for my English
--
View this message in context: http://n2.nabble.com/ChannelBuffer-and---messageReceived-tp1943393p1943393.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list