Closed ontytoom closed 8 years ago
This is a good question :smile: The FTP client is divided into two parts:
FtpClient
class itself contains information about FTP site, credentials, etc. It is the logical information.FtpSession
holds an active connection to this target FTP site. It is the "physical" (sort of) part.So you can have multiple FtpSessions
running at the same time, typically for parallel transfers, where each session handles a single transfer.
The FTP client allows also to work without having to use sessions directly (the FtpClientUtility
class does this by implementing common commands).
If you don't feel the need to use sessions, then this means you don't need them. But you'll probably feel that need if you want to implement parallel transfers :wink:
Does this help?
Thank you, this is a rather helpful explanation.
So far I have had multiple concurrent connections to the FTP server by making multiple instances of the FtpClient class. In my app, I have a browse window and a recursive analysis window. Each of them uses a separate FtpClient instance, because I thought it helps with concurrency. In the previous versions of my app they used to share the same FtpClient instance, but then analysis would pause for a moment when the user is browsing interactively. To solve this, I made multiple instances of FtpClient class.
Do you think my approach is equivalent to using FtpSession?
Yes, it is equivalent.
I see. Thank you for the info.
(I don't see any way to ask a question, so I am putting this into an issue, but it's really a request for info.)
What is the advantage for using a session? The documentation on the main page shows me how to make a session, but does not explain what is useful about it.
In case you are curious how I am using your library, please see https://github.com/ontytoom/AntonFtpClient