users@grizzly.java.net

ReadHandler not returning error on client disconnect

From: gagansnt <gagansnt_at_gmail.com>
Date: Wed, 30 Mar 2011 02:04:51 -0700 (PDT)

I am using Grizzly NIOInputStream and response suspend/resume facility to
read from clients.
Problem I am facing, When a client stops sending file due some error or
network problem then I do not get any exception or error message on server
side. I am using exactly the same code as mentioned in one of the samples on
Grizzly website - Do I need to make any further changes in code in order to
know that client has stopped sending data.

in.notifyAvailable(new ReadHandler() {
          @Override
          public void onDataAvailable(){
            try {
              doWrite(this, in, buf, out, parser);
            } catch (IOException e) {
              logger.fatal(e.toString());
            }catch (Exception e) {
              logger.fatal(e.toString());
            }
          }
          @Override
          public void onError(Throwable t) {
            logger.info(inputFile+" [onError]" + t.toString());
            System.out.println(inputFile + " [onError]" + t.toString());
          }
          @Override
          public void onAllDataRead() {
            System.out.println("[onAllDataRead] length: " + in.readyData());
            logger.info("[onAllDataRead] length: " + in.readyData());
            try {
              doWrite(this, in, buf, out, parser);
            } catch (IOException e) {
              logger.fatal(e.toString());
            }
            response.resume();
          }
        });


Thanks in advance
Gagan

--
View this message in context: http://grizzly.1045725.n5.nabble.com/ReadHandler-not-returning-error-on-client-disconnect-tp4271055p4271055.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.