public void logout() throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException {
synchronized (lock) {
    if (!connected) {
      throw new IllegalStateException("Client not connected");
    }
    if (!authenticated) {
      throw new IllegalStateException("Client not authenticated");
    }
    communication.sendFTPCommand("REIN");
    FTPReply r=communication.readFTPReply();
    if (!r.isSuccessCode()) {
      throw new FTPException(r);
    }
 else {
      stopAutoNoopTimer();
      authenticated=false;
      username=null;
      password=null;
    }
  }
}

public void logout ( ) throws IllegalStateException , IOException , FTPIllegalReplyException , FTPException { synchronized ( lock ) { if ( ! connected ) { throw new IllegalStateException ( "Client not connected" ) ; } if ( ! authenticated ) { throw new IllegalStateException ( "Client not authenticated" ) ; } communication . sendFTPCommand ( "REIN" ) ; FTPReply r = communication . readFTPReply ( ) ; if ( ! r . isSuccessCode ( ) ) { throw new FTPException ( r ) ; } else { stopAutoNoopTimer ( ) ; authenticated = false ; username = null ; password = null ; } } }
this method performs a logout operation for the current user , leaving the connection open , thus it can be used to start a new user session . be careful with this : some ftp servers don ' t implement this feature , even though it is a standard ftp one .
