Hi,
I'm developing a client server application, where server is socket
server as well as an RMI server. The socket client sends binary data
to to the server. I want to return the inputstream to the RMI client
as the socket client starts writing it to the outputstream so that the
socket server don't have to buffer the data. Is there any way to get
the message as the InputStream in messageReceived function?
I wrote following code in the doDecode function
protected boolean doDecode(IoSession session, IoBuffer ib,
ProtocolDecoderOutput out) throws Exception {
int remaining = ib.remaining();
if (remaining >= SIZE) {
System.out.println("remaining = " + remaining);
InputStream is = ib.asInputStream();
out.write(is);
return true;
} else {
return false;
}
}
org.apache.mina.filter.codec.ProtocolDecoderException:
java.lang.IllegalStateException: doDecode() can't return true when
buffer is not consumed.
Basically, the amount of data that is received can be huge, hence I
don't want to buffer it at server and gives it to the RMI client as
soon as the socket server starts receiving it.
What shall I need to do if i want to receive the network stream in the
messageReceived function, or is there any better way to accomplished
the task?
Thanks,
Atul