wodSFTP using SCP? (General questions)
Can I use the wodSFTP component to do SCP?
Re: wodSFTP using SCP?
Hi,
Unfortunately that's not possible with wodSFTP.
However, wodSSH could implement SCP. You can download the free trial of wodSSH from our site, and try out the sample Implementing SCP which is included into the component.
Hope I helped.
Regards,
Damba
Re: wodSFTP using SCP?
I must also ask - are you sure you need SCP? If you use any newer SSH server, then SFTP is also supported. SFTP is much better than SCP and in 99.99 cases it is provided - so my suggestion would be to try wodSFTP, perhaps it works for you too.
Regards,
Kreso
Re: wodSFTP using SCP?
We have been transfering successfully during testing using SFTP but there is now a problem with the destination server. After a consistent amount of files have transfered the server stops responding. It has been reported that SCP works better so that has prompted my question.
Re: wodSFTP using SCP?
I have downloaded and installed wodSSH. How do I upload files? Do I use the Execute and run a command similar to scp testFile.xml user@192.168.0.2: , or do I use the send or sendEof methods?
Re: wodSFTP using SCP?
Hi,
Yes, in case of using scp you need to send an appropriate command to the server. You can use any of those two methods. The difference is that Execute requires Blocking mode to function, and that is also my suggestion.
You should also use WaitFor Method prior to Execute, since WaitFor will cause wodSSH to wait until the appropriate pattern has been received.
Regards,
Damba
Re: wodSFTP using SCP?
I am having trouble getting the waitfor command to work, I am in blocking mode.
Do you have a code example of the Send or SendEOF
Does it matter that this app is multi-threaded in Delphi?
Thanks.
Brad
Re: wodSFTP using SCP?
Hi,
Could you provide us more information about the issue?
What exactly happens? Do you get an error?
Could you prepare a sample for us which we could run on our side in order to duplicate the issue?
Regards,
Damba
Re: wodSFTP using SCP?
Below is my connect:
SSH.Prompt := 'regex[$ #>] $';
SSH.Connect;
This is the results that get printed from OnStateChange:
Stated Changed Connecting to server (from Disconnected from server)
Stated Changed Connected to server - idle (from Connecting to server)
Stated Changed Receiving data from server (from Connected to server - idle)
Stated Changed Connected to server - idle (from Receiving data from server)
This is the code to do my upload:
//turn on blocking
SSH.Blocking := true;
SSH.WaitFor('regex[$ #>] $');
SSH.Execute('scp /local user@host:/remotpath');
The command waitfor never responds, I don't receive an error. Also what is interesting is that the OnPromptReceived event does not fire. This may be related.
I don't have sample code the would work well in your environment I hope this helps though. Thanks for the help.
Brad
Re: wodSFTP using SCP?
Hi Brad,
Did you try out our sample which comes with wodSSH ( Implementing SCP )? Did that work?
Also, Blocking needs to be set before calling Connect Method.
If the OnPromptReceived Event isn't triggered, probably the component really didn't receive the expected prompt?
If you connect using Putty what prompt do you receive?
Regards,
Damba
Re: wodSFTP using SCP?
I did see a reference on your forum to an example of using SCP with SSH however I did not find it. I will look again as soon as I return to the office, or is there a link to an online help reference?
I did connect through putty and the prompt received was user@hostname ~ . I did not disclose the actual user and host but the format is exactly the same.
Thank you again for the quick responses.
Brad
Re: wodSFTP using SCP?
Brad,
You should try modifying the Prompt Property to match the one you received in Putty, or adding ~ to your regex expression. Can you try that?
Also, the sample i mentioned is under VB folder located in the installtion path you specified when you installed the component.
Regards,
Damba
Re: wodSFTP using SCP?
Yes I did and it helped thank you. I didn't notice there were different examples in the component folder as opposed to the activeX folder.
However the sample only shows how to transfer one file. I want to transfer many files within a directory and I can only get scp to work if I set the command prior to connect using the file name I am transferring. Do I have to then re-connect each time I send a file?
Re: wodSFTP using SCP?
Hi Brad,
You can try to send scp -f filename or scp -t filename with Send Method just after connection is established with server.
That way you don't need to use Command Property and wodSSH will not automatically disconnect when execution of command is finished.
You should also remove Disconnect Method from a sample code.
Hope this helps.
Regards,
Drazen