LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ftp - active or passive mode (https://www.linuxquestions.org/questions/programming-9/ftp-active-or-passive-mode-621153/)

kshkid 02-14-2008 03:10 PM

ftp - active or passive mode
 
Hi All,

Here is a question about active (PORT) and passive (PASV) connection modes in ftp.

When I run ftp command from command prompt manually,

default connection mode is passive.
I have to issue *passive* command to toggle to *active* mode.

Will this be the same behavior if that is done programmatically ?
What is the default connection mode if the server accessed via java code ?

Do I need to explicitly mention it as below

Code:

client.enterLocalActiveMode();
?

thanks

paulsm4 02-15-2008 09:27 PM

Hi -

The core Java language (i.e. "java.net") doesn't *have* any classes specifically for FTP. You get to write one of your own (it's not difficult), or use some other, 3rd party class.

Two Pop Favorites are:

* Apache Commons
http://commons.apache.org/

.. and ..

* Sun Tools (unsupported, but pretty standard - and very useful):
http://www.nsftools.com/tips/JavaFtp.htm

You chose the former. The documentation - and complete source code - are on-line. That's probably the easiest way to answer your question.

PS:
Whether an FTP client is active or passive depends entirely on the client - different "ftp" commands will all behave differently.

Here's a good tutorial:
http://www.enterprisedt.com/publicat..._Overview.html


All times are GMT -5. The time now is 03:21 AM.