SFTP AttributesDataDelegate Not Executing - WeOnlyDo Discussion board

SFTP AttributesDataDelegate Not Executing (General questions)

by Harewood, Wednesday, December 26, 2012, 21:27 (4146 days ago)

Hey, I have been trying to retreive the attributes of a files after they have been copied to the remote client. Your SFTP DLL has a method GetAttributes(string RemotePath) and this method calls back to the delegate AttributesDataDelegate(object Sender, SFTP.AttributesArgs[] Args). This delegate never fires after the method is fired. Do you have a sample which your provide with this function working?

Re: SFTP AttributesDataDelegate Not Executing

by woddrazen, Thursday, December 27, 2012, 10:48 (4145 days ago) @ Harewood

Hi,


Here is simple example that will show you how to use GetAttributes Method inside wodSFTP.NET.
[code]WeOnlyDo.Client.SFTP sftp1;
private void Form1_Load(object sender, EventArgs e)
{
sftp1 = new WeOnlyDo.Client.SFTP();
sftp1.AttributesEvent += new WeOnlyDo.Client.SFTP.AttributesDelegate(sftp1_AttributesEvent);
sftp1.ConnectedEvent += new WeOnlyDo.Client.SFTP.ConnectedDelegate(sftp1_ConnectedEvent);

sftp1.Hostname = your_hostname ;
sftp1.Login = your_login ;
sftp1.Password = your_password ;
sftp1.Connect();
}

void sftp1_ConnectedEvent(object Sender, WeOnlyDo.Client.SFTP.ConnectedArgs Args)
{
if (Args.Error == null)
{
sftp1.GetAttributes( /home/somepath/somefile.rar );
}
else
Console.WriteLine( Error: + Args.Error.Message);
}

void sftp1_AttributesEvent(object Sender, WeOnlyDo.Client.SFTP.AttributesArgs Args)
{
Console.WriteLine(Args.ModificationTime.ToString());
}[/code]
Drazen