Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Issue: Files are getting truncated when uploading to the SSH server. [1466]

$
0
0
Hi,
I noticed unexpected behaviour, when I was sending a number of files to the SSH server, each file with a size approx. equal to 35 kB.
Every file on the destination machine was truncated to 16384 kB.
When i set BufferSize property to 32716 on the SftpClient object and then called the UploadFile method on that object, every file transferred to the SSH server was truncated to 32716 kB.
I'm using OpenSSH server v. 6.1p1.
This has not happened, (not so often at least) when I ran the library in the debug mode. Perhaps when the runtime hits the breakpoint, any particular thread has a chance to finish which is not the case in the release mode.
I'm not sure what else I could provide to help you trace the problem.
Can I have some advice on this? Perhaps I'm using wrong patter to send files to the remote server.

Regards,
Martin.
Comments: ** Comment from web user: dragonmilan **

Thank you for your quick reply.
To simplify pattern which I used to transfer files to the remote server, I would paste only part of the code which is most relevant to the problem (in my opinion personal opinion):

foreach (DictionaryEntry file in fileWalker.Files)
{
string fullLocalPathToFile = Path.GetFullPath(file.Key.ToString());

FileStream fs = new FileStream(fullLocalPathToFile, FileMode.Open, FileAccess.Read, FileShare.Read);

sftpClient.UploadFile(fs, file.Value.ToString());
...
}

Moreover, I only noticed aforementioned problem, when my source was mapped to the network share, e.g.
when I tried to upload data from the location O:\dir1\dir2\dir3 to the SSH server. When I copied manually the same source folder to my local machine and then copied it to the SSH server, I noticed all transferred files had a correct size.


Viewing all articles
Browse latest Browse all 1026

Trending Articles