SSH & SCP - WeOnlyDo Discussion board

SSH & SCP (General questions)

by Andrew, Monday, August 23, 2004, 23:36 (7178 days ago)

I'm trying to implement ssh vb component sample 5 (transferring a file through SCP) with openSSH on windows (http://sshwindows.sourceforge.net/).

It seems like it completes the send randomly. Sometimes when I click upload (a 2k file) it won't create the file on the remote server. I've enabled recieved debugging msg, and when this behavior happens, it tells me 1212 bytes recieved. It will also create the file with zero bytes and output the same status. When I click upload again, I can still be left without any remote file. Eventually it returns 1212 bytes recieved, then either 1213 bytes recieved or 1214 bytes recieved on the subsequent line. The file is successfully transferred in those instances.

The behavior does not change when protcol is set to auto or ssh2.

Any ideas?

Re: SSH & SCP

by wodSupport, Tuesday, August 24, 2004, 00:25 (7178 days ago) @ Andrew

Andrew,

why don't you use wodSFTP instead? I am sure OpenSSH (and it's windows version) supports it, will work much better, more reliable, and MUCH faster than SCP you're trying to implement. I strongly suggest you try it!

But, if you must use SCP for some other reason, let me try to help. Did you use our sample exactly? How can I duplicate this problem?

Regards.

Re: SSH & SCP

by Andrew, Tuesday, August 24, 2004, 15:09 (7177 days ago) @ wodSupport

Yes, I've compiled directly from the sample, editing only the add recieved bytes line (removing comment). I'm uploading a text file from c:
outer.txt to /home/router.txt - there are no files in the remote directory. I had to upload 6 times until I got 1213 bytes recieved (and the file was no longer zero bytes). Sometimes it goes on the first attempt, sometimes not. Six is definately the max so far. I did not delete the empty file after each attempt.

Re: SSH & SCP

by wodSupport, Tuesday, August 24, 2004, 15:42 (7177 days ago) @ Andrew

Andrew,

I will try to duplicate your problem today with windows OpenSSH and see if it needs to be fixed. Will keep you posted.

Regards,
Kreso

Re: SSH & SCP

by wodSupport, Wednesday, August 25, 2004, 23:01 (7176 days ago) @ wodSupport

Andrew,

I think I got it. Just for a test - if you use our sample to upload, and remove Ssh.SendEOF and Ssh.Disconnect calls - does it work? Do you have complete files?

Kreso

Re: SSH & SCP

by Andrew, Thursday, August 26, 2004, 16:55 (7175 days ago) @ wodSupport

I just commented those lines out and recompiled. It's working with all files!

The only other thing I'm noticing (and it's really a non issue) is that when uploading small files (2kb txt), done will be displayed in the list but it will be followed by recieved 1213 and 1214. This doesn't happen with larger files. It also doesn't seem to happen when I add breaks at add debug done and adddebug recieved .

Thanks for your help. Now that I know it will work, I'll be buying the component for my project soon!

Re: SSH & SCP

by wodSupport, Thursday, August 26, 2004, 17:10 (7175 days ago) @ Andrew

Andrew,

works? Excellent. Now I will also play a bit to make sure it works even if SendEOF is used afterwards. I just wanted to double-check with you if you can duplicate the issue in the same way as I am.

I hope to fix and publish update even today.

Regards,
Kreso

Re: SSH & SCP

by wodSupport, Friday, August 27, 2004, 01:05 (7175 days ago) @ wodSupport

Andrew,

this is now fixed. Please download wodSSH again. Before you call SendEOF method, set wodSSH.Blocking = True so that any leftovers from outgoing buffers are sent to the server. After that it's safe to Disconnect.

Hope it will work correctly.

Regards,
Kreso

Re: SSH & SCP

by Andrew, Monday, August 30, 2004, 18:00 (7171 days ago) @ wodSupport

I downloaded from the SSH product page, but it still gives me 2.2.0.3 (July revision, same as my current version). Should I be downloading it from a different location?

Re: SSH & SCP

by wodSupport, Monday, August 30, 2004, 20:52 (7171 days ago) @ Andrew

Andrew,

version number is not yet increased. It will with some major update.

Kreso

Re: SSH & SCP

by Andrew, Monday, August 30, 2004, 22:33 (7171 days ago) @ wodSupport

Ok. The reason I asked is because it was not working for me.

New Ver - If I select the source as c:xxx.txt it will upload with blocking set to true on the line before.

New Ver - If I set the source as c:documents and settingsandrewmy documentsxxx.txt, it will not upload properly (just 1212 bytes received). I had done this originally and that's why i didn't think I was getting the updated component. After testing, a file from this location will only successfully upload with ssh1.Disconnect commented out (in SCPFileUpload).

I interpreted your previous post of it being safe to disconnect after the send EOF so long as blocking is set to true as meaning that I no longer needed to comment ssh1.Disconnect - and does seem to work in some instances.

Prev Ver - c:doucments and settinsandrewmmy documentsxxx.txt is a valid location and the file does upload (with sendeof & disconnect commented out). The only catch is that it says 'done' after 1212 bytes received but follows with 1213 & 1214 bytes received (after done). The same thing is happening with the newest version. ssh1.Disconnect executes before add.debug 'done'. If disconnect is commented out, bytes 1213 and/or 1214 are being recieved after SCPFileUpload is finished executing (add.debug done)- and these are neccessary for a successful file transfer. Forcibly disconnecting at the end of SCPUpload leaves those bytes out there.