EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Download a file

Posted: 02/01/2012 08:34:08
by Eugene Mayevski (Team)

SendKeepAlive is present in SSH client and in TElSimpleSSHClient. It's not exposed in TElSimpleSFTPClient.

Sincerely yours
Eugene Mayevski
Posted: 02/01/2012 10:51:21
by sean rogers (Basic support level)
Joined: 02/01/2012
Posts: 5


I didnt get an error reported with the DownloadStream - it still just hung.

But I have managed to download the two big files I had by following the FileOpen/Read/CloseHandle pattern.

Here is my code that worked:

public string ReadFile(string source)

Check.RequireNotNullOrEmpty(() => source);

byte[] handle = null;
var buffer = new byte[BufferSize];
var charsReadSoFar = 0;

handle = Client.OpenFile(source, (int) FileOpenModeType.Read, (int) FileOpenAccessType.ReadLock, null);

using (var memoryStream = new MemoryStream())
var charsRead = ReadChunkFromFile(memoryStream, handle, ref charsReadSoFar, buffer);
while (charsRead == BufferSize)
charsRead = ReadChunkFromFile(memoryStream, handle, ref charsReadSoFar, buffer);

memoryStream.Position = 0;

var document = new XmlDocument();
return document.OuterXml;

private int ReadChunkFromFile(Stream memoryStream, byte[] handle, ref int charsReadSoFar, byte[] buffer)
var charsRead = Client.Read(handle, charsReadSoFar, ref buffer, BufferSize);
charsReadSoFar = charsReadSoFar + charsRead;
memoryStream.Write(buffer, 0, charsRead);
return charsRead;

Thanks for your help.




Topic viewed 2279 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!