Ftp Object : Progress Event |
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 _ ) |
Value | Description |
---|---|
ftpAbort | Ftp ABOR command. |
ftpAccount | Ftp ACCT command. |
ftpAllocate | Ftp ALLO command. |
ftpAppend | Ftp APPE command. |
ftpAuthSsl | Ftp AUTH SSL command (used with security). |
ftpAuthTls | Ftp AUTH TLS command (used with security). |
ftpAuthTlsP | Ftp AUTH TLS-P command (used with security). |
ftpCCC | Ftp CCC command (used with security). |
ftpChangeDirectory | Ftp CWD command. |
ftpChangeDirectoryUp | Ftp CDUP command. |
ftpDelete | Ftp DELE command. |
ftpEPRT | Ftp EPRT command (used with IPV6). |
ftpEPSV | Ftp EPSV command (used with IPV6). |
ftpFileStructure | Ftp STRU command. |
ftpHelp | Ftp HELP command. |
ftpList | Ftp LIST command. |
ftpMakeDirectory | Ftp MKD command. |
ftpNameList | Ftp NLST command. |
ftpNoOperation | Ftp NOOP command. |
ftpOpen | Ftp OPEN command (used with proxy). |
ftpPassive | Ftp PASV command. |
ftpPassword | Ftp PASS coomand. |
ftpPBSZ | Ftp PBSZ command (used with security). |
ftpPort | Ftp PORT command. |
ftpPrintDirectory | Ftp PWD command. |
ftpPROT | Ftp PROT command (used with security). |
ftpQuit | Ftp QUIT command. |
ftpReinitialize | Ftp REIN command. |
ftpRemoveDirectory | Ftp RMD command. |
ftpRenameFrom | Ftp RNFR command. |
ftpRenameTo | Ftp RNTO command. |
ftpRestart | Ftp REST command. |
ftpRetrieve | Ftp RETR command. |
ftpSite | Ftp SITE command. |
ftpSize | Ftp SIZE command. |
ftpStatus | Ftp STAT command. |
ftpStore | Ftp STOR command. |
ftpStoreUnique | Ftp STOU command. |
ftpStructureMount | Ftp SMNT command. |
ftpSystem | Ftp SYST command. |
ftpTransferMode | Ftp MODE command. |
ftpType | Ftp TYPE command. |
ftpUser | Ftp USER command. |
ftpUserCommand | User defined command. |
Value | Description |
---|---|
ftpError | Last command failed to complete OK. |
ftpInProgress | Operation is incomplete and the last command completed OK (more FTP commands are pending). |
ftpOk | Operation is complete and the last command completed OK. |
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.
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