Dart Ftp Control
Progress Event
FTP protocol command that corresponds to Reply.
Indicates that Reply is a final success indication, an intermediate success indication, or a failure.
Provides the complete reply from the server. This is normally a 3-digit number, followed by a space, followed by descriptive text. It may be a multi-line reply. See RFC 959 for the technical details.
Indicates the number of bytes that have transferred (so far) for the transfer in progress. Will normally start at 0 and increase to Size. Only valid when FtpCmd is ftpRetrieve, ftpStore, ftpStoreUnique or ftpAppend; it is 0 at other times.
Indicates the total number of bytes in the file or buffer for the transfer in progress. This value is constant during each transfer. Only valid when FtpCmd is ftpRetrieve, ftpStore, ftpStoreUnique or ftpAppend; it is 0 at other times.
Description
Fires when the server replies to a command or while a file transfer takes place. The control interprets the reply and presents progress information with this event.
Syntax
Visual Basic
Public Event Progress( _
   ByVal FtpCmd As CommandConstants, _
   ByVal Status As StatusConstants, _
   ByVal Reply As String, _
   ByVal Count As Long, _
   ByVal Size As Long _
)
Parameters
FtpCmd
ValueDescription
ftpAbortFtp ABOR command.
ftpAccountFtp ACCT command.
ftpAllocateFtp ALLO command.
ftpAppendFtp APPE command.
ftpAuthSslFtp AUTH SSL command (used with security).
ftpAuthTlsFtp AUTH TLS command (used with security).
ftpAuthTlsPFtp AUTH TLS-P command (used with security).
ftpCCCFtp CCC command (used with security).
ftpChangeDirectoryFtp CWD command.
ftpChangeDirectoryUpFtp CDUP command.
ftpDeleteFtp DELE command.
ftpEPRTFtp EPRT command (used with IPV6).
ftpEPSVFtp EPSV command (used with IPV6).
ftpFileStructureFtp STRU command.
ftpHelpFtp HELP command.
ftpListFtp LIST command.
ftpMakeDirectoryFtp MKD command.
ftpNameListFtp NLST command.
ftpNoOperationFtp NOOP command.
ftpOpenFtp OPEN command (used with proxy).
ftpPassiveFtp PASV command.
ftpPasswordFtp PASS coomand.
ftpPBSZFtp PBSZ command (used with security).
ftpPortFtp PORT command.
ftpPrintDirectoryFtp PWD command.
ftpPROTFtp PROT command (used with security).
ftpQuitFtp QUIT command.
ftpReinitializeFtp REIN command.
ftpRemoveDirectoryFtp RMD command.
ftpRenameFromFtp RNFR command.
ftpRenameToFtp RNTO command.
ftpRestartFtp REST command.
ftpRetrieveFtp RETR command.
ftpSiteFtp SITE command.
ftpSizeFtp SIZE command.
ftpStatusFtp STAT command.
ftpStoreFtp STOR command.
ftpStoreUniqueFtp STOU command.
ftpStructureMountFtp SMNT command.
ftpSystemFtp SYST command.
ftpTransferModeFtp MODE command.
ftpTypeFtp TYPE command.
ftpUserFtp USER command.
ftpUserCommandUser defined command.
FTP protocol command that corresponds to Reply.
Status
ValueDescription
ftpErrorLast command failed to complete OK.
ftpInProgressOperation is incomplete and the last command completed OK (more FTP commands are pending).
ftpOkOperation is complete and the last command completed OK.
Indicates that Reply is a final success indication, an intermediate success indication, or a failure.
Reply
Provides the complete reply from the server. This is normally a 3-digit number, followed by a space, followed by descriptive text. It may be a multi-line reply. See RFC 959 for the technical details.
Count
Indicates the number of bytes that have transferred (so far) for the transfer in progress. Will normally start at 0 and increase to Size. Only valid when FtpCmd is ftpRetrieve, ftpStore, ftpStoreUnique or ftpAppend; it is 0 at other times.
Size
Indicates the total number of bytes in the file or buffer for the transfer in progress. This value is constant during each transfer. Only valid when FtpCmd is ftpRetrieve, ftpStore, ftpStoreUnique or ftpAppend; it is 0 at other times.
Remarks

The size of a retrieved file is found by sending the ftpSize command after ftpType command. If the server does not support the ftpSize command, then the size of the file is parsed out of the Reply parameter (the 150 reply usually includes the size of the file). The size is not usually accurate on ASCII transfers when the 150 reply is used, because the server is sending a CR/LF pair at the end of each line (instead of the single LF character that is often used on UNIX systems). Some servers (VAX systems, for example) will not even provide the size in the 150 reply, so 1 is reported (this value was chosen so you won't get an unintentional divide by 0 error).

Use the Trace method to gather any protocol level data if the Reply parameter is not adequate.

Example
Private Sub Ftp1_Progress(ByVal FtpCmd As DartFtpCtl.CommandConstants, ByVal Status As DartFtpCtl.StatusConstants, ByVal Reply As String, ByVal Count As Long, ByVal Size As Long)
	On Error Goto OnError ' use intrinsic error handling
	Ftp1.TimeOut = 0
	If Status = ftpOk Then
		' Use select to control what to do next
		Select Case FtpCmd
		Case ftpPassword
			' we are logged in, so issue Retrieve command
			Ftp1.Retrieve "RemoteFile.txt", "LocalFile.txt"
		Case ftpRetrieve
			' file transfer is complete...close
			Ftp1.Logout
		End Select
	ElseIf Status = ftpInProgress Then
		If FtpCmd = ftpRetrieve Then Label1.Caption = Count / Size * 100 & "%" & " done..."
	End If
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
See Also

Ftp Object  | Ftp Members


PowerTCP SSL for ActiveX Documentation Version 2.2.1
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic