On Wed, Jun 2, 2010 at 2:59 PM, Haim, Ran <[email protected]> wrote:
I'm using your ftp server and currently it doesn't check if the address
is already in use.
I need the server to check if the address its using isn't in use and to
fail if it is in use.
This should already be the case. I just verified this on my laptop.
Could you please describe further how to reproduce the problem.
I get the same behaviour.
The following simple program, successfully serves up an ftp site. If
started again, it logs that the FtpServer has started. My eclipse
debugger shows that the acceptor thread has started. The first one still
works, as expected. The second just sits there forever.
import java.io.File;
import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory;
import org.apache.ftpserver.ftplet.FileSystemFactory;
import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
public class SimpleFtpServer {
public static void main(String[] args) throws FtpException {
final FtpServerFactory serverFactory = new FtpServerFactory();
final FileSystemFactory fsFactory = new NativeFileSystemFactory();
serverFactory.setFileSystem(fsFactory);
final ListenerFactory factory = new ListenerFactory();
factory.setPort(21);
serverFactory.addListener("default", factory.createListener());
final PropertiesUserManagerFactory umf = new
PropertiesUserManagerFactory();
umf.setFile(new File("ftpusers.properties"));
serverFactory.setUserManager(umf.createUserManager());
final FtpServer server = serverFactory.createServer();
server.start();
}
}
--
Albert Visagie