mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neill Alexander" <neillalexan...@gmail.com>
Subject Re: sessionClosed Called Before All Data Read
Date Tue, 11 Jul 2006 11:31:26 GMT
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 <neillalexander@gmail.com> 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....
>

Mime
View raw message