You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by Ashok Patel <ap...@worlddocument.com> on 2007/02/27 15:18:20 UTC

How to change default FTP Server Port # in Java code?

I want the FTP Server to listen on other port # before
I do "server.start();" in Java code.

Currently, I have FTP Server working on Default port.

Thanks,
Ashok


Re: How to change default FTP Server Port # in Java code?

Posted by Niklas Gustavsson <ni...@protocol7.com>.
Ashok Patel wrote:
> I want the FTP Server to listen on other port # before
> I do "server.start();" in Java code.
> 
> Currently, I have FTP Server working on Default port.

There are multiple ways, one using the configuration as described here:
http://incubator.apache.org/ftpserver/listeners.html

If you're running FtpServer embedded in a Java application, the 
following code might make more sense to use:

         FtpServer server = new FtpServer();
         FtpServerContext context = server.getServerContext();
         ((MinaListener)context.getListener("default")).setPort(123);

         server.start();

/niklas