So here is what i determined... I get faldse negative response from OpenFTP() and because the code (Seen below) gave me 3 failures each time, I thought it was actually failing to open and do the ExamineFTPDirectory(0) which turns out was also working:
Code: Select all
Repeat
count + 1
;Debug count
;Debug USER$+" "+DeCrypt(FTPassword$)
s$ = DeCrypt(FTPassword$)
If OpenFTP(0, " ftp://ftp.domain.com", USER$,Trim(DeCrypt(FTPassword$)),#True)
s$ = ""
;Debug "DID HOME LIST CONNECT", 2
SetGadgetText(#FTPstatus_0,"Connected to Server")
If CreateFile(10,"C:\ONELOG\Server.dat",#PB_Ascii)
If ExamineFTPDirectory(0) ; Step thru Server Directory to get file list
While NextFTPDirectoryEntry(0)
If FTPDirectoryEntryType(0) = #PB_FTP_File
entry$ = FTPDirectoryEntryName(0) +" "+ FTPDirectoryEntryDate(0)
If FindString(entry$,"C:\ONELOG\") = 0
If FindString(entry$,"pref") = 0 ;not collecting ,pref files.
If FindString(Lastfilelist$,entry$) = 0 ; no match means download required
; ;Debug entry$
If FindString(entry$,"CUSTOMER.ARC")
;MessageRequester("Need Update", "Need customer file for latest update", #MB_OK|#MB_ICONINFORMATION)
Changes = #True
EndIf
If FindString(entry$,RegisteredUser$)
usrprfs = #True
EndIf
AddElement(fileList.s())
d$ = StringField(entry$,1," ")
If FindString(entry$,"C:\ONELOG\") = 0
fileList() = d$ ; hold name only for Inv_Home to do download
EndIf
;Debug d$, 2
;Debug "ADDED - "+fileList()
EndIf
EndIf
WriteStringN(10,entry$,#PB_Ascii)
EndIf
EndIf
Wend
FinishFTPDirectory(0)
;Debug "End of Directory", 2
Else
MessageRequester("Access Error", "AutoFTP failure -- Unable to view files on FTP server.", #MB_OK|#MB_ICONWARNING)
EndIf
CloseFile(10)
Else
MessageRequester("File Error", "AutoFTP Failure -- Cannot create server.dat file.", #MB_OK|#MB_ICONWARNING)
EndIf
If FileSize("C:\ONELOG\CUSTOMER.ARC") = -1
;Debug "CUSTOMER.ARC is missing", 2
ForEach fileList()
If fileList() = "CUSTOMER.ARC"
present = #True
EndIf
Next
If present = 0
AddElement(fileList.s())
fileList() = "CUSTOMER.ARC" ; download if file is missing locally no matter what.
EndIf
EndIf
If usrprfs = 0
SendFTPFile(0,HOME$+RegisteredUser$,RegisteredUser$)
EndIf
CloseFTP(0)
Else
;Debug "NO Connect"
fail + 1
Delay(1400)
EndIf
;Debug "inventory home "+Str(count)
Until count = 3
If count = 3
MessageRequester("FTP Login failure", "FTP is enabled." + Chr(10) + "Cannot inventory ftp.domain.com")
Endif
So now I am abandoning the 3 time fail approach. Instead I grab the file timestamp before I try FTP and compare that after FTP. If different then success. Just can't rely on OpenFTP to return true when successful, at least in 64 Bit ver 5.40. And I don't see any difference in ver 5.62 or 6.21. It's a crying shame.