I've detected a problem with HBTIP FTP download.
If the connection fails during file downloading, oFtp:DownloadFile returns .t..
You can test simply unplugging the network cable during download.
Code: Select all
FUNCTION MAIN
cServer := 'server:port'
cUser := "user"
cPassword := "pass"
cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer
oUrl := tUrl():New( cUrl )
oFTP := tIPClientFtp():New( oUrl, .F. )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .T.
IF At( "@", cUser ) > 0
oFTP:oUrl:cServer := cServer
oFTP:oUrl:cUserID := cUser
oFTP:oUrl:cPassword := cPassword
ENDIF
IF oFTP:Open( cUrl )
? 'downloading...'
// HERE!!!!
// If connection fails during downloading, no error
// occurs and the 'OK' alert is shown.
// It can be tested, simply unplugging the LAN
// cable while file is downloading.
IF !oFtp:DownloadFile( 'test.dat' )
oFTP:Close()
ALERT('Error!' )
RETURN NIL
ENDIF
oFTP:Close()
// and HERE!
ALERT('Ok')
ELSE
ALERT('Error!')
ENDIF
Return Nil
TIA.