Events and Blocking Property problems (Component busy error).
When you use Events and Blocking = False (default value for Blocking Property) you cannot execute methods line by line.
Component didn\'t menage to execute all from first method and began to execute second method.
As a result of that action you can get "Component busy" or some other error.
You can avoid that action by using Blocking = True and execute methods line by line.In that case you cannot use Events.
Or you can for example create some collection of files and upload one by one file from that collection to server. In that case you can use Events.
Here is example of uploading files to server using Blocking = True. Example is in VB6:
Private Sub Form_Load() Dim sftp1 As wodSFTPCom
Dim Dir As String
Set sftp1 = New wodSFTPCom
sftp1.HostName = "put.your.hostname"
sftp1.Login = "put.your.login"
sftp1.Password = "put.your.password"
sftp1.Blocking = True
sftp1.Connect
Dir = "/home/something/abc/"
sftp1.MakeDir Dir
sftp1.PutFile App.Path & "\file1.txt", Dir & "file1.txt"
sftp1.PutFile App.Path & "\file2.txt", Dir & "file2.txt"
sftp1.PutFile App.Path & "\file3.txt", Dir & "file3.txt"
sftp1.Disconnect
End Sub
this example shows how to upload files to the server using Events and Blocking = False. Example is also in VB6:
Dim WithEvents sftp1 As wodSFTPCom
Dim MyCol As Collection
Dim Dir As String
Private Sub Form_Load()
Set sftp1 = New wodSFTPCom
Set MyCol = New Collection
MyCol.Add "file1.txt"
MyCol.Add "file2.txt"
MyCol.Add "file3.txt"
sftp1.HostName = "put.your.hostname"
sftp1.Login = "put.your.login"
sftp1.Password = "put.your.password"
sftp1.Connect
End Sub
Private Sub sftp1_Connected(ByVal ErrorCode As Integer, ByVal ErrorText As String)
Dir = "/home/something/abc/"
sftp1.MakeDir Dir
End Sub
Private Sub sftp1_Done(ByVal ErrorCode As Integer, ByVal ErrorText As String)
Dim elem As String
If MyCol.Count > 0 Then
elem = MyCol.Item(1)
MyCol.Remove 1
sftp1.PutFile App.Path & "\" & elem, Dir & elem
Else
sftp1.Disconnect
End If
End Sub