hi,all
when I use client connector and call session.close(),it doesn't work. I use tcpdump and netstat and find that the connection is still established after session.close(). I use jdk 1.5.04 to compile it and running it under jdk 1.5.04 ubuntu 8.10, and then the problem occurs. But it works fine when i compile it by jdk1.5.04 and running it under jdk1.6 unbuntu 8.10.
  The code is below:

   public static void main(String args[]){
       NioSocketConnector connector=new NioSocketConnector();
       connector.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 5);
       connector.setHandler(new IoHandlerAdapter(){

           public void sessionClosed(IoSession arg0) throws Exception {
               System.out.println("session closed ");
           }

           public void sessionIdle(IoSession session, IdleStatus arg1)
                   throws Exception {
               System.out.println("idle session");
               session.close(true);
           }
       });
       connector.connect(new InetSocketAddress("10.10.41.230",9088));
       try {
           Thread.sleep(50000);
       } catch (InterruptedException e) {
           e.printStackTrace();
       }
}

thanks for your reading and wait for your apply.

Reply via email to