wodSFTP ActiveX Control - Progress64 Event
    
 

Description

Fires during file send/receive operations.


Syntax

Private Sub object_Progress64(PositionLo, PositionHi, TotalLo, TotalHi)



The Progress64 Event syntax has these parts:

Part Description
object A wodSFTP object.
PositionLo A Long value. Lower long value of a 64bit integer for the current transfer position.
PositionHi A Long value. Higher long value of a 64bit integer for the current transfer position.
TotalLo A Long value. Lower long value of a 64bit integer for the total number of bytes that should be transferred.
TotalHi A Long value. Higher long value of a 64bit integer for the total number of bytes that should be transferred.

Remarks

This event can be used for monitoring file transfers. It is fired during any file transfer started by the GetFile or PutFile methods. It will be fired several times, depending on the speed of your network (thus the length of packets sent/received), file size and other factors. There is no default rule defining the exact number of times it will be fired.

Once a transfer is finished, the Position argument will have the same value as the Total argument. As long as file size does fit into a 32bit long integer, the Progress event will be fired. If either of the position or total arguments do not fit into a 32bit long integer, the Progress64 event will be fired instead. Depending on the programming language you use, you will need to convert these values to appropriate int64 integers.

Also, once a file transfer is finished, the Done event will be fired.

NOTE: it is possible that Position or Total values become negative - it is because unsigned values are used, but VB (and other environments) expect to see signed values. If this happens, we suggest you use following code (VB example):

Private Const MAX_UNSIGNED = 4294967296# ' HEX 1,0000,0000

Private
Sub Sftp1_Progress(ByVal Position As Long, ByVal Total As Long)
   Ftp1_Progress64 Position, 0, Total, 0
End Sub

Private Sub Sftp1_Progress64(ByVal PositionLo As Long, ByVal PositionHi As Long, ByVal TotalLo As Long, ByVal TotalHi As Long)
   If TotalLo <> 0 And TotalHi <> 0 Then
      Dim pos As Double
      Dim tot As Double

      pos = PositionLo
      If (pos < 0) Then pos = pos + MAX_UNSIGNED
      tot = TotalLo
      If tot < 0 Then tot = tot + MAX_UNSIGNED

      If TotalHi <> 0 Then
         pos = pos + PositionHi * MAX_UNSIGNED
         tot = tot + TotalHi * MAX_UNSIGNED
      End If

      Debug.Print "Progress " & pos & "/" & tot
   Else
      Debug.Print "Progress " & PositionLo & "/" & TotalLo
   End If
End
Sub