Android FTP server authenticates once -


i trying implement ftp server in application using apache ftp server library.

the server , running , working fine, once.

note: using hardcoded user now. username: test , password: test

so in order:

  1. app launched, server started, lets ftp clients login.

  2. app killed user.

  3. app started user , server started. replies 530 authentication failed user logging in username: test , password: test

after responds 530 authentication failed

my code below making server:

public void makepropertiesfile(){     file file = new file(environment.getexternalstoragedirectory().getabsolutepath()+"/download/user.properties");     if(file.exists() == false){         try {             file.createnewfile();             logmessage("user.properties file did not exist, made one");             properties = file;             this.addusers();         } catch (ioexception e) {             e.printstacktrace();         }     }     else {         logmessage("file exists, no need recreate");         usermanagerfactory = new propertiesusermanagerfactory();         usermanagerfactory.setfile(properties);         usermanagerfactory.setpasswordencryptor(new saltedpasswordencryptor());         org.apache.ftpserver.ftplet.usermanager usermanager = usermanagerfactory.createusermanager();         serverfactory.setusermanager(usermanager);     } }  public void addusers(){     usermanagerfactory = new propertiesusermanagerfactory();     usermanagerfactory.setfile(properties);     usermanagerfactory.setpasswordencryptor(new saltedpasswordencryptor());     baseuser = new baseuser();     baseuser.setname("test");     baseuser.setpassword("test");     baseuser.sethomedirectory(environment.getexternalstoragedirectory().getabsolutepath());     baseuser.setenabled(true);     list<authority> authorities = new arraylist<authority>();     authorities.add(new writepermission());     baseuser.setauthorities(authorities);     org.apache.ftpserver.ftplet.usermanager usermanager = usermanagerfactory.createusermanager();     try {         usermanager.save(baseuser);     } catch (ftpexception e) {         e.printstacktrace();         logmessage("could not save user");     }     serverfactory.setusermanager(usermanager); }  public void start(){     serverfactory = new ftpserverfactory();     listenerfactory = new listenerfactory();     listenerfactory.setport(port);     serverfactory.addlistener("default",listenerfactory.createlistener());     ftpserver = serverfactory.createserver();     this.makepropertiesfile();     try {         ftpserver.start();         logmessage("started ftp server on port: " + port);     } catch (ftpexception e) {         e.printstacktrace();         logmessage("failed start ftp server on port: " + port);     }  } 

see link http://androidexample.com/ftp_file_upload_from_sdcard_to_server/index.php?view=article_discription&aid=98&aaid=120

has working project ftp android app


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -