Oh dear. It probably didn't help that I called session.close() in the
server! Funnily enough when I removed that, the problem went away.

Sorry for the unnecessary noise...


Neill

On 7/11/06, Neill Alexander <[EMAIL PROTECTED]> wrote:
Hi

I have an client application using Mina 0.8.2. I send a request to a
custom server, which sends back a response. The client extends
IoHandlerAdapter and reads the response data in the dataRead( )
method.

The dataRead( ) gets called multiple times (which is fine) and I build
up the response gradually. According to the logging, the
sessionClosed( ) method gets called before I have received the full
response. I can see on the server side the response string, but only
receive a part of it back.

It looks like the response gets truncated at the same point each time.
So the problem might relate to the length of the response?? I don't
know. I'm struggling to understand the issue..

If anyone has any suggestions on how to proceed with debugging this, I
would very much appreciate it.

thanks


Neill

Start of the dataRead( ) method below.

    public void dataRead(IoSession session, ByteBuffer buf) {

        boolean readResponse = false;

        // Get the data buffer (if we have it)
        StringBuilder responseBuffer = (StringBuilder)
        session.getAttribute(RESPONSE_DATA_BUFFER_KEY);

        if (responseBuffer == null) {
            responseBuffer = new StringBuilder();
        }

        try {
            // Explicitly expect UTF-8 strings
            Charset charset = Charset.forName("UTF-8");
            CharsetDecoder decoder = charset.newDecoder();
            String response = buf.getString(decoder);

            responseBuffer.append(response);

           etc etc....

Reply via email to