I Applicate SFTP Technology in Data Synchronization Project on May.SFTP Programe is build in C# Frame.It clude a Base Operator Class and a dll file it called Renci.SshNet.dll.Below give everyone general explanation:
1.Quote
using Renci.SshNet;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2. Connect and Disconnect Function
class SftpOperator
{
#region declare a variable its type is ScpClient
private SftpClient ssh;
/// <Title>
/// SFTP Connect Status
/// </Title>
public bool Connected { get { return ssh.IsConnected; } }
#endregion
#region
/// <Title>
/// construct function
/// </Title>
/// <Parameter name="ip">IP</parameter>
/// <Parameter name="port">Port</parameter>
/// <Paramter name="user">UserName</parameter>
/// <Paramter name="pwd">Password</parameter>
public SftpOperator(string ip, string port, string user, string pwd)
{
ssh = new SftpClient(ip, int.Parse(port), user, pwd);
}
#endregion
#region
/// <Title>
/// Connect SFTP
/// </Title>
/// <returns>true Success</returns>
public bool Connect()
{
try
{
if (!Connected)
{
ssh.Connect();
}
return true;
}