You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by va...@webmail.co.za on 2006/09/29 16:09:51 UTC

commons-vfs - Using FTPClient

I have the following code and I am attempting to get
a file stored locally, from an FTP site. The file exists
in the parent directory of the FTP site...


//CODE
String filename = "file.zip";

FTPClient f = new FTPClient();
f.connect("ftp.site.com")
f.login("loginname", "password");
System.out.println(f.getReplyString());
f.changeToParentDirectory();

f.type(FTPClient.BINARY_FILE_TYPE);

File file = new File("C:" + File.separator + "temp" + File.separator +
filename);
FileOutputStream fos = new FileOutputStream(file);
f.retrieveFile(filename, fos );
fos.close();

System.out.println(f.getReplyString());
f.logout();
System.out.println(f.getReplyString());
f.disconnect();




This is what the output displays.... message 425 takes about 20
seconds to display... Can anyone help me with this? Thanks!!!!




//OUTPUT
230 Login successful. Have fun.

425 Failed to establish connection.

221 Goodbye.






-------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [net] Using FTPClient [was: Re: commons-vfs - Using FTPClient]

Posted by va...@webmail.co.za.
Great! The firewall was indeed the problem, since it could
not manage active sessions.

Thanks alot.


> Hi!
>> This is what the output displays.... message 425 takes about 20
>> seconds to display... Can anyone help me with this? Thanks!!!!
>>
>
>> //OUTPUT
>> 230 Login successful. Have fun.
>>
>> 425 Failed to establish connection.
>>
>> 221 Goodbye.
>>
>
> For me this is a problem with your (or the other side) firewall
> configuration.
> Sometimes a firewall do not support "active" ftp connections.
> You can try to use f.enterLocalPassiveMode() (or so, sorry, I do not
> remember the correct syntax yet).
> This way commons-net will try to use passive ftp data connections which
> might have more success bypassing a firewall.
>
> But ... this has nothing to do with commons-vfs, do you try to use
> commons-net through commons-vfs (using a ftp filesystem)?
> Then there is a FtpFileSystemConfigBuilder which allows you to
> setPassiveMode(opts, true).
> If you need more support with this, just ask again.
>
> Ciao,
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>



-------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [net] Using FTPClient [was: Re: commons-vfs - Using FTPClient]

Posted by va...@webmail.co.za.
Great! Got it sorted out...it was the firewall
not being able to handle a active FTP session.

Thaks alot!


> Hi!
>> This is what the output displays.... message 425 takes about 20
>> seconds to display... Can anyone help me with this? Thanks!!!!
>>
>
>> //OUTPUT
>> 230 Login successful. Have fun.
>>
>> 425 Failed to establish connection.
>>
>> 221 Goodbye.
>>
>
> For me this is a problem with your (or the other side) firewall
> configuration.
> Sometimes a firewall do not support "active" ftp connections.
> You can try to use f.enterLocalPassiveMode() (or so, sorry, I do not
> remember the correct syntax yet).
> This way commons-net will try to use passive ftp data connections which
> might have more success bypassing a firewall.
>
> But ... this has nothing to do with commons-vfs, do you try to use
> commons-net through commons-vfs (using a ftp filesystem)?
> Then there is a FtpFileSystemConfigBuilder which allows you to
> setPassiveMode(opts, true).
> If you need more support with this, just ask again.
>
> Ciao,
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>



-------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [net] Using FTPClient [was: Re: commons-vfs - Using FTPClient]

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> This is what the output displays.... message 425 takes about 20
> seconds to display... Can anyone help me with this? Thanks!!!!
>   

> //OUTPUT
> 230 Login successful. Have fun.
>
> 425 Failed to establish connection.
>
> 221 Goodbye.
>   

For me this is a problem with your (or the other side) firewall
configuration.
Sometimes a firewall do not support "active" ftp connections.
You can try to use f.enterLocalPassiveMode() (or so, sorry, I do not
remember the correct syntax yet).
This way commons-net will try to use passive ftp data connections which
might have more success bypassing a firewall.

But ... this has nothing to do with commons-vfs, do you try to use
commons-net through commons-vfs (using a ftp filesystem)?
Then there is a FtpFileSystemConfigBuilder which allows you to
setPassiveMode(opts, true).
If you need more support with this, just ask again.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org