• Post Reply Bookmark Topic Watch Topic
  • New Topic

FTP, data connection, and Sockets -- Apache Commons and ftp4j open/close Socket for each file?  RSS feed

Lynn Richards
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that FTP uses two connections--a control connection and a data connection. The control connection is established once, and then sends commands that, if a proper response is received, means a data connection may be opened.

The app that I have uses Apache Commons for FTP. It opens the control once, then sends multiple files via FTP. I noticed in the storeFile method, every time this method is called, it opens and closes a new Socket. My kneejerk reaction is that seems excessive...that I would want to reuse the same Socket. What I don't understand is why it does that. Is it because every single request for STOR must have a separate data connection? I'm just trying to understand why it works this way.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!