• Post Reply Bookmark Topic Watch Topic
  • New Topic

Queries related to Minimizing FTP Connections

 
Talib Jockey
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using org.apache.commons.net.FTPClient to connect to a remote FTP Server. I need to formulate a stratergy to minimize connections to the FTP Server. My queries are:

1) What if I open a connection(passive) and keep sending NOOP every 10 seconds, will the connection ever timeout by itself, as long as I dont explicitly disconnect it?

2) Can a FTP Server disconnect a client after a specified amount of time, even though its not idle? Is that configurable on a FTP Server?

3) Which is a better stratergy...
a) Make a single connection and perform all jobs with the same connection, without disconnecting after each job?
b) Make a new connection for each job and disconnect after completion of that job?

Any pointers on the above queries would be appreciated. Thanks!
 
Jan Cumps
Bartender
Posts: 2614
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) What if I open a connection(passive) and keep sending NOOP every 10 seconds, will the connection ever timeout by itself, as long as I dont explicitly disconnect it?
Some FTP servers notice that you are trying to keep the connection alive (they recognize patterns that try to fool them), and will timeout anyway.

2) Can a FTP Server disconnect a client after a specified amount of time, even though its not idle? Is that configurable on a FTP Server?
Yes, although this seldom happens in passive mode. I've seen ftp servers time out when running in active mode, and performing a large up- or download. Timeout is configurable on most servers.

3) Which is a better stratergy...
a) Make a single connection and perform all jobs with the same connection, without disconnecting after each job?
b) Make a new connection for each job and disconnect after completion of that job?
If it's a batch job, I usually perform all actions in one session, and disconnect after completion.
If it's a single action, I also disconnect after it's finished.
I never leave a connection open for reuse by a next job.

Regards, Jan
 
Talib Jockey
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton Jan!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!