how can i capture exception when the sftp connecti - WeOnlyDo Discussion board

how can i capture exception when the sftp connecti (General questions)

by hit_arc, Tuesday, March 25, 2008, 07:02 (6087 days ago)

Hi,

Can anyone guide me how to capture an exeception when the connection with remote server is lost. I mean a file was getting transferred and then i unplugged my network cable. What happens is state_changedevent is fired with newstate = disconnected but no exception arises no done_event is fired. How can i track exceptions in that.

I am using PutFiles with blocking = true.

Thanks in advance

Re: how can i capture exception when the sftp conn

by woddrazen, Tuesday, March 25, 2008, 09:08 (6087 days ago) @ hit_arc

Hi,


In non blocking mode Done event should fired with some error. I receive this error when using PutFiles Method and unplugged my lan cable: 30027 - Component was busy and got disconnected.

In blocking mode you can use LastError Property to find out which error is received.

More help for LastError Property you can find here:
http://www.weonlydo.com/SFTP.NET/Help/WeOnlyDo.Client.SFTP.LastError.html

Let us know how it goes.


Regards,
Drazen

Re: how can i capture exception when the sftp conn

by hit_arc, Tuesday, March 25, 2008, 12:24 (6087 days ago) @ woddrazen

Hi,
Well i have used LastError() property to fetch the error but the debugger is not going ahead after sftp.GetFiles(LocalDirectoryPath,RemoteDirectoryPath,maxLevel). It is just going to Sftp.StateChangedEvent and when i check the newstate inside that event it shows me Args.NewState = Disconnected[6]

I have used the LastError property after calling getfiles method

Sftp.GetFiles(LocalDir, RemoteDir, maxLevel)
If Not IsNothing(Sftp.LastError) Then
errorLog = Sftp.LastError.Message()
End If

errorLog is a variable.

Re: how can i capture exception when the sftp conn

by woddrazen, Tuesday, March 25, 2008, 13:33 (6087 days ago) @ hit_arc

Hi Archit,


As Damba already mention you should set Args.Error = null (Nothing in VB) inside LoopError event. Error will be completely ignoring. All other files should be uploaded and Done Event should be fired.

Can we please discuss all your issues here? You can ask all your questions here and don't open new thread each time. You should use wodSFTP.NET in non blocking mode to use Events. If you want to use wodSFTP.NET in blocking mode (sftp1.Blocking =True) you shouldn't use Events.

About your PutFiles issue. We have duplicated some problem with PutFile Method. Component for some reason terminate upload and didn't fired any error. So you cannot receive error.
I have forward it to our programmers they will try to duplicate it and resolve it.


Drazen

Re: how can i capture exception when the sftp conn

by woddrazen, Tuesday, March 25, 2008, 16:04 (6087 days ago) @ woddrazen

Archit,


Can you please check error in Disconnected Event using Args.Error variable? Seems that there is some issue with my machine and PutFile isn't workings as expected.


Drazen

Re: how can i capture exception when the sftp conn

by hit_arc, Thursday, March 27, 2008, 12:36 (6085 days ago) @ woddrazen

Hi,

Can you quide me which one is better in terms of performance..
Looping through the files in my local directory and transferring those files using PutFile or using PutFiles. In blocking mode.
As the LoopItem event also gets fired while using PutFiles Method.

Regards
Archit Agg

Re: how can i capture exception when the sftp conn

by woddrazen, Thursday, March 27, 2008, 13:57 (6085 days ago) @ hit_arc

Archit,


If you don't want to upload all files from some folder and you want to use wodSFTP in blocking mode, I would suggest you to use PutFile Method.

You can use Events (LoopItem Event and PutFiles) only in non blocking mode when Blocking Property is set to False.


Drazen