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 "John Race (BE/ETL)" <jo...@ericsson.com> on 2007/05/08 14:40:46 UTC

Set IP Address

if i run the embedded ftp server in a java application on a pc with more than 1 network card, how can i set the IP address of the ftp server. At the moment it defaults to the wrong one.
 
___________________ 
Ericsson Limited 
Registered Office: Unit 4, Midleton Gate, Guildford Business Park, Guildford, Surrey, GU2 8SG 
Registered Number in England and Wales: 942215 
This communication is confidential and intended solely for the addressee(s). Any unauthorised review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.
Ericsson Limited does not enter into contracts or contractual obligations via electronic mail, unless otherwise agreed in writing between the parties concerned.
E-mail including attachments is susceptible to data corruption, interruption, unauthorised amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof. 
________________________ 

Re: Set IP Address

Posted by Niklas Gustavsson <ni...@protocol7.com>.
John Race (BE/ETL) wrote:
> I've tried setting the properties as you suggested but still not working. I'm probably doing something fundamentally wrong but don't know what. Here's my code:
>  
> Properties prop = new Properties();
> prop.setProperty("config.listeners.default.address","19.0.60.241");
> prop.setProperty("config.listeners.default.data-connection.class","org.apache.ftpserver.DefaultDataConnectionConfig");
> prop.setProperty("config.listeners.default.data-connection.passive.address","19.0.60.241");
>  
> Configuration config = new PropertiesConfiguration(prop);
>  
> IFtpConfig ftpConfig = new FtpConfigImpl( config );
> m_ftpServer = new FtpServer(ftpConfig);
> m_ftpServer.start();

First of all, sorry for taking such a long time to respond to your email!

Judging from your code you're using a very old version of FtpServer. I 
would strongly recommend you to update to a later version. Also, when 
trying to write up an example for you, I discovered that our 
documentation was in fact incorrect. I've updated to code to fix this 
(accept what is documented).

Now, with the latest code, the following example should work for you:

Properties prop = new Properties();
prop.setProperty("config.listeners.default.address","19.0.60.241");
prop.setProperty("config.listeners.default.data-connection.class","org.apache.ftpserver.DefaultDataConnectionConfig");
prop.setProperty("config.listeners.default.data-connection.passive.address","19.0.60.241");

Configuration config = new PropertiesConfiguration(prop);

ConfigurableFtpServerContext ctx = new ConfigurableFtpServerContext( 
config );

FtpServer server = new FtpServer(ctx);

server.start();

/niklas


RE: Re: Set IP Address

Posted by "John Race (BE/ETL)" <jo...@ericsson.com>.
I've tried setting the properties as you suggested but still not working. I'm probably doing something fundamentally wrong but don't know what. Here's my code:
 
Properties prop = new Properties();
prop.setProperty("config.listeners.default.address","19.0.60.241");
prop.setProperty("config.listeners.default.data-connection.class","org.apache.ftpserver.DefaultDataConnectionConfig");
prop.setProperty("config.listeners.default.data-connection.passive.address","19.0.60.241");
 
Configuration config = new PropertiesConfiguration(prop);
 
IFtpConfig ftpConfig = new FtpConfigImpl( config );
m_ftpServer = new FtpServer(ftpConfig);
m_ftpServer.start();
 
Many thanks 
 
JR
 
 
 
___________________ 
Ericsson Limited 
Registered Office: Unit 4, Midleton Gate, Guildford Business Park, Guildford, Surrey, GU2 8SG 
Registered Number in England and Wales: 942215 
This communication is confidential and intended solely for the addressee(s). Any unauthorised review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.
Ericsson Limited does not enter into contracts or contractual obligations via electronic mail, unless otherwise agreed in writing between the parties concerned.
E-mail including attachments is susceptible to data corruption, interruption, unauthorised amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof. 
________________________ 

________________________________

From: news on behalf of Niklas Gustavsson
Sent: Tue 08/05/2007 19:13
To: ftpserver-dev@incubator.apache.org
Subject: Re: Set IP Address



Clinton Foster wrote:
> I am not sure if this has changed in the newer releases that are based on
> MINA, but it used to be that the following two configuration parameters
> controlled this:
>
>     config.socket-factory.address - bind address for control connections
>     config.data-connection.passive.address - bind address for passive
> connections


They have indeed changed in the new code. They are now called:
config.listeners.<listener name>.address
config.listeners.<listener name>.data-connection.passive.address

For your default listener, you would therefore need the following config:

config.listeners.default.address=1.2.3.4
config.listeners.default.data-connection.class=org.apache.ftpserver.DefaultDataConnectionConfig
config.listeners.default.data-connection.passive.address=1.2.3.4

/niklas




Re: Set IP Address

Posted by Niklas Gustavsson <ni...@protocol7.com>.
Clinton Foster wrote:
> I am not sure if this has changed in the newer releases that are based on
> MINA, but it used to be that the following two configuration parameters
> controlled this: 
> 
>     config.socket-factory.address - bind address for control connections
>     config.data-connection.passive.address - bind address for passive
> connections


They have indeed changed in the new code. They are now called:
config.listeners.<listener name>.address
config.listeners.<listener name>.data-connection.passive.address

For your default listener, you would therefore need the following config:

config.listeners.default.address=1.2.3.4
config.listeners.default.data-connection.class=org.apache.ftpserver.DefaultDataConnectionConfig
config.listeners.default.data-connection.passive.address=1.2.3.4

/niklas


Re: Set IP Address

Posted by Clinton Foster <cf...@us.axway.com>.
I am not sure if this has changed in the newer releases that are based on
MINA, but it used to be that the following two configuration parameters
controlled this: 

    config.socket-factory.address - bind address for control connections
    config.data-connection.passive.address - bind address for passive
connections

On 5/8/07 7:40 AM, "John Race (BE/ETL)" <jo...@ericsson.com> wrote:

> if i run the embedded ftp server in a java application on a pc with more than
> 1 network card, how can i set the IP address of the ftp server. At the moment
> it defaults to the wrong one.
>  
> ___________________
> Ericsson Limited 
> Registered Office: Unit 4, Midleton Gate, Guildford Business Park, Guildford,
> Surrey, GU2 8SG 
> Registered Number in England and Wales: 942215
> This communication is confidential and intended solely for the addressee(s).
> Any unauthorised review, use, disclosure or distribution is prohibited. If you
> believe this message has been sent to you in error, please notify the sender
> by replying to this transmission and delete the message without disclosing it.
> Thank you.
> Ericsson Limited does not enter into contracts or contractual obligations via
> electronic mail, unless otherwise agreed in writing between the parties
> concerned.
> E-mail including attachments is susceptible to data corruption, interruption,
> unauthorised amendment, tampering and viruses, and we only send and receive
> e-mails on the basis that we are not liable for any such corruption,
> interception, amendment, tampering or viruses or any consequences thereof.
> ________________________