[ 
https://issues.apache.org/jira/browse/FTPSERVER-369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aniceto Pérez y Madrid updated FTPSERVER-369:
---------------------------------------------

    Attachment: ftp4j-1.5.jar
                Main.java

David

I used ftp-server 1.0.4 unmodified using ftpd-typical.xml. Access is 
always named, not anonymous, and the problems arise running on Linux and 
Windows. I'm sending you a Java class and a free ftp library for you to 
test it. Just run the ftpserver as bin\ftpd res\conf\ftpd-typical.xml 
and then run the Java class.

Regards
Aniceto Perez



-- 

Aniceto Pérez y Madrid ape...@innovasoftps.com 
<mailto:ape...@innovasoftps.com>
Director General

*Innovasoft Proyectos y Servicios, SL*
Ferraz, 28 2º izq
E-28008 MADRID
Tel: +34 915 488 601
http://www.innovasoftps.com

Acceda remotamente a su ordenador Windows con Famatech Radmin 
http://www.innovasoftps.com

 

 


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ftpsmasher;

import it.sauronsoftware.ftp4j.FTPAbortedException;
import it.sauronsoftware.ftp4j.FTPClient;
import it.sauronsoftware.ftp4j.FTPDataTransferException;
import it.sauronsoftware.ftp4j.FTPException;
import it.sauronsoftware.ftp4j.FTPFile;
import it.sauronsoftware.ftp4j.FTPIllegalReplyException;
import it.sauronsoftware.ftp4j.FTPListParseException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrador
 */
public class Main {

    String ftpHost = "localhost", ftpUser = "admin", ftpPasswd = "admin";
    int ftpPort = 2121;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Main();
    }

    Main() {
        while (true) {
            try {
                try {
                    Thread.sleep(300);
                } catch (Exception e) {
                }
                FTPClient ftp = new it.sauronsoftware.ftp4j.FTPClient();
                ftp.connect(ftpHost, ftpPort);
                ftp.login(ftpUser, ftpPasswd);
                FTPFile[] list = ftp.list("*.*");
                try {
                    ftp.logout();
                } catch (Exception ee) {
                }
                try {
                       ftp.disconnect(true);
                } catch (Exception ee) {
                }


            } catch (IllegalStateException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (FTPIllegalReplyException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (FTPException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (FTPDataTransferException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (FTPAbortedException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            } catch (FTPListParseException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, 
ex);
            }

        }
    }
}


> maxLogin is reached immediately 
> --------------------------------
>
>                 Key: FTPSERVER-369
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-369
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.4
>         Environment: Linux or Windows
>            Reporter: Aniceto Pérez y Madrid
>             Fix For: 1.0.5, 1.1.0
>
>         Attachments: ftp4j-1.5.jar, Main.java
>
>
> I've created a simple program loop which open, connect and disconnect. If the 
> max-logins parameter is set to 10, the message "Too many users logged in, 
> user will be disconnected" is issued after 10 loops
> The cause is in DefaultFtpStatistics. In this function
>  
>  public synchronized void setLogout(final FtpIoSession session) {
>         User user = session.getUser();
>         if (user == null) {
>             return;
>         }
>         currLogins.decrementAndGet();
> session.getUser() always returns null, so never currLogins.decrementAndGet() 
> is called. My workaround is to put that statement before testing user null 
> state. 
> Why      session.getUser()  return null is out of my knowledge.
>   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to