Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Sftp uploads empty file

$
0
0

This is my working code, very simplied since i handle it as interfaces and firing event and other stuff:

// been Client
SftpClient Client = new SftpClient(Host, User, Password);publicoverridevoid GetFile(string localFile, string remoteFile)
{if (!Client.IsConnected)
        Client.Connect();using (var fileStream = File.OpenWrite(localFile))
    {
         Client.DownloadFile(remoteFile, fileStream);
    }
}publicoverridevoid PutFile(string localFile, string remoteFile)
{if (!Client.IsConnected)
        Client.Connect();using (var file = File.OpenRead(localFile))
    {
        Client.UploadFile(file, remoteFile);
    }
}


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>