iOS Question Ftp works only for the first file

Jean Weets

Member
Licensed User
Longtime User
I have an FTP connection and want to run multiple command's (List and opload and download) but it stops after a first success. (No result)
Under B4A it works perfectly.
Is it because FTP.isinitialised is not available B4i?
 

Jean Weets

Member
Licensed User
Longtime User
I removed some private code:


Public Sub Synchroniseren
........
......

hd.ProgressDialogShow("Login...")
htpcl.Initialize("webClient")
If htpcl.IsInitialized Then
httpreq.InitializePost2("http://www.rijdendpersoneel.be/frpinlog.php", requeststring.GetBytes("UTF8"))
' httpreq.SetHeader("Content-Type", "text/xml; charset=utf-8")
httpreq.Timeout = 100000
htpcl.Execute(httpreq, 1)
End If
End Sub

Sub webclient_ResponseSuccess (Response As HttpResponse, TaskId As Int)
If TaskId = 1 Then
Try
resp = Response.GetString2("UTF8")
Catch

End Try

hd.ProgressDialogHide
If resp = "fout" Then
If lang = "fr" Then
Msgbox("Login erreur","Erreur")
Else
Msgbox("Login fout","Fout")
End If
Else
If File.Exists(TargetDir & "/diensttabel","") = False Then
File.MakeDir(TargetDir , "diensttabel")
End If
FrpIn.Initialize
FrpIn.Add("naam")'TSNaamInfrp.text)
FrpIn.Add("wacht")'TSWachtInfrp.text)
File.WriteList(TargetDir & "/diensttabel","frplogin.txt",FrpIn)
flok =True
Dim filename As String = yr & "_" & resp
FTPf.Initialize("FTPlistRoot","ftp.rijdendpersoneel.be",21,*****,********)
ftpfn = filename
FTPf.PassiveMode = True
FTPf.List("/dtabs/")
End If
End Sub

Sub FTPlistRoot_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
If Success = False Then
flok = False
Else

FTPf.Initialize("FTP1","ftp.rijdendpersoneel.be",21,*****,********)
FTPf.PassiveMode = True

FTPf.DownloadFile("/specdnst.dks" , False,TargetDir & "/diensttabel", "Specdnst.dks")


For i = 0 To Files.Length - 1
Dim ftpt As Long=0
Dim ftps As Long =0

Dim flsi As String=Files(i).Name & " "
If flsi.Substring2(5,FTPfl.Length + 5) = ftpfn.Substring(5) Then
ftps = Files(i).Timestamp
Catch
End Try
If ftpt>ftps Then
FTPf.UploadFile(TargetDir & "/diensttabel" , Files(i).Name, False ,ServerPath & Files(i).Name)

Else If ftpt<ftps Then
FTPf.DownloadFile(ServerPath & Files(i).Name , False,TargetDir & "/diensttabel" , Files(i).Name )

End If
FTPf.DownloadFile("/" & flsi.SubString2(0,4) & ".sks" , True,TargetDir & "/diensttabel",flsi.subString2(0,4) & ".sks")
i=Files.Length
End If
FTP.DownloadFile("/Specdnst.dks" , True,TargetDir, "Diensttabel/Specdnst.dks")

Next
End If

End Sub

Sub FTP1_DownloadCompleted (ServerPath As String, Success As Boolean)
' Log(ServerPath & ", Success=" & Success)
If Success Then
' LDfilename.Text=LDfilename.Text & "Dnl " & ServerPath.substring(ServerPath.LastIndexOf("/")+1) & " ok" & CRLF
Else
' LDfilename.Text=LDfilename.Text & "Dnl " & ServerPath.substring(ServerPath.LastIndexOf("/")+1) & " err" & CRLF
flok = False
End If
'LDfilename.top = 10-su.MeasureMultilineTextHeight(LDfilename, LDfilename.Text)
If Success Then
.........
 
Last edited:
Upvote 0

Jean Weets

Member
Licensed User
Longtime User
Sorry for the codes :|

Http goes also to synchronize files?

And there is also a possibility for File.LastModified under B4i ?
 
Upvote 0

Jean Weets

Member
Licensed User
Longtime User
@Erel.
You already have a solution to this problem?
My filesystem in Dtabs working with Phone, Android, Windows, Java is built around my ftp.
The final step was IOS. It works only with the first FTP download. :|
 
Upvote 0

Jean Weets

Member
Licensed User
Longtime User
I have tried different solutions but always after a first successful ftp call the next ftp commands are dead!
 
Upvote 0

Jean Weets

Member
Licensed User
Longtime User
I created a simple example.

The first successful step -> Ok
The following does no mention or any error
 

Attachments

  • FTPtest.zip
    3.9 KB · Views: 223
Upvote 0

johan vetsuypens

Member
Licensed User
Longtime User
I have the same issue downloading files or getting a list of files from turbo-ftp.com. only the first FTP action works.
I used the FTPtest app from Jean, and only changed the credentials
FTP.Initialize("FTPCommand", "turbo-ftp.com", 21, "*", "*")
Using the new 1.01 iNet lib on PC and local Mac Builder.
I can send you my credentials if you want.

Also does the DownloadProgress function not work any more on B4I (used it on B4A)

thanks
Johan
 
Upvote 0

Jean Weets

Member
Licensed User
Longtime User
It works fine now with iNet 1.0.1.
Are you sure you are using the lib 1.0.1? (see picture)

inet.jpg
 
Upvote 0
Top