We need to create an executable program which would send and receive files from the server of the client. The client is already preparing to purchase an SFTP facility of this.
My question is:
1. Can a java program connect to existing SFTP facilities (e.g. RSIT)
2. Is there still a need to have an SFTP facility or is there an existing or new library in java which can do this? if yes, is this a better solution than #1?
3. If #2 is recommended, is jftp still the recommended API for this?
#2 - I'm not sure what you're asking. If you need SFTP -because that's what your client uses- how does something help? Or are you asking how to implement secure file transfer for a greenfield implementation where SFTP isn't set from the start?
#3 - jftp seems to be a GUI client; if you need programmatic SFTP access, then JSch is probably the way to go.
Thanks for the input Ulf.
What I mean is, can the java api that can do sftp work on its own? or is it dependent on some sort of installation of an SFTP facility in the server ? If yes, that would save our client money because they won't be needing to purchase the SFTP facility to be stored on their server, let the API do all the work.
Sorry guys, I got confused with my own question myself haha. Lets start all over.
Ok java connecting to SFTP? check! (Jsch).
My questions are:
1. Would the logic to connect to the sftp server depend on the brand of the SFTP facility ? (e.g. RSIT)
2. Can this handle real time? or batch transfer is advised? both in send and receive
Andres Delrotti wrote:Would the logic to connect to the sftp server depend on the brand of the SFTP facility ? (e.g. RSIT)
SFTP is intended to be interoperable. If you are wondering about a particular implementation such as Attachmate’s RSIT, would you need to try it to be sure, but it would be pretty safe to assume it will work.
Has anyone tried using these? I'm just worried about using Jsch if it would perform well in a real time file transfer requirement.
Bascially, the setup we want is this.
(Two way file transfer)
Server1-outbound folder ---> Server2-inbound folder
Server2-outbound folder ----> Server 1-inbound folder
Basically file transfer is initiated when a file is dropped off at an outbound folder from either server.
Is this possible in java APIs such as jsch? or third party tools like those in the link I posted is better suited for this?
Andres Delrotti wrote:^^
Can jsch do that without polling? i mean can it "listen" if files are dropped off at a certain folder so that it can receive or send it?
i have googled some jsch codes and seen some but not sure if reading or sending files can be automatically triggered
You are asking too much of SSH and therefore jsch. SSH is a well defined protocol (there are something like 5 applicable RFCs which Google will find) for securely communicating between a client and a server. In it's minimal form SSH does not even have file transfer but SSH does have a standard way of adding functionality and most SSH clients and servers support the SCP and SFTP file transfer protocol extensions. Presumably you need transfer files from the server to the client as soon as they become available on the server. One could do this with jsch or any of the standard Java SSH libraries but you would need to poll the server since there is nothing build into the SSH protocol to allow ans SSH client to be notified of server side file system changes. I do foresee a problem with polling in that it could be difficult to know when a file is actually available as a whole and not currently being written.