-1

I'm new to SFTP and recently started using WinSCP at my work. We authenticate to the SFTP server using a private key. We are building an error-log parser that fetches the error-log of our server through WinSCP once in a while (every 10 seconds or so), and parses it to display an overview of our errors visually (or play a sound if there have been many errors lately).

Now, I suppose that SFTP is FTP, just based on a secure protocol. If I'm not mistaken, FTP supports partial filetransfers given an offset (say that I want to transfer everything after the first 1000 bytes for instance). The reason I need this functionality is that we want to reduce the load of the server, so that I only download the changes of the file.

My specific implementation is SharpSSH, but I am okay with switching to another SFTP solution if SharpSSH can't handle partial downloads.

Where do I begin? I tried Googling it but without results.

Mathias Lykkegaard Lorenzen
  • 15,031
  • 23
  • 100
  • 187

2 Answers2

1

SFTP is not FTP and has very little in common with FTP. However, you can use SFTP to access parts of the file. This requires use of low-level methods offered by SFTP, such as OpenFile, ReadFile and CloseHandle (those methods are very similar to usual filesystem operations but they are executed by the SFTP server). I doubt that SharpSSH or anything similar offers such method. Our SecureBlackbox does, though, so you can use it for your task.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • How do I know if the server supports those low-level methods? – Mathias Lykkegaard Lorenzen Jun 28 '13 at 07:21
  • 1
    @MathiasLykkegaardLorenzen All servers do. In fact, that are the functions used by any client to transfer the files. Strange thing is that most client libraries don't offer those functions to the user but only offer methods to transfer files in whole. And SFTP by design is a protocol for accessing and managing remote filesystem on quite low level (unlike FTP protocol). – Eugene Mayevski 'Callback Jun 28 '13 at 08:15
  • Thanks for your answer. However, I want to use it as a for-fun project, so I don't feel like paying. Instead, I'll just download the source codes of SharpSSH and expose the methods on my own. – Mathias Lykkegaard Lorenzen Jun 28 '13 at 12:11
-1

I ended up using SSH .NET. It works like a charm, and is a full free wrapper for .NET that supports partial transfers with private keys and everything.

Mathias Lykkegaard Lorenzen
  • 15,031
  • 23
  • 100
  • 187