Android Question FTP_ListCompleted Event Not Firing

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Everyone,

I have this code which i have used earlier also but for some reason in this project it is not working.

B4X:
    ft.Initialize("ft","ftp.xyz.com",21,"MyFTP","MyPwd")
    ft.PassiveMode=True
    ft.List(Starter.gsCmpyCode&"/MyFolder/")
    Wait For ft_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry) 
    if success then
       .......

I put break point on Wait... it never goes to next line (if success... )

I think I am missing something.

Can some one please give some clue

Thanks
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
Your code sample looks fine to me. The only question I have is "What is the value of Starter.gsCmpyCode?". Does it end with "/"? If so your folder path value might be causing the problem.
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Thanks Brian,
The value os Starter.gsCmpycode is a normal string it does not end with "/". The problem seems to be somewhere else.
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Anyway, try using:
B4X:
ft.List(File.Combine(Starter.gsCmpyCode, "MyFolder"))

Also, write a log of Starter.gsCmpyCode
Thanks LucaMs,
No luck,
As I said, i am missing something like in manifest.
I even tried ft.List("/") still the ListComplete event does not fire.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Hi Everyone,

I have this code which i have used earlier also but for some reason in this project it is not working.

B4X:
    ft.Initialize("ft","ftp.xyz.com",21,"MyFTP","MyPwd")
    ft.PassiveMode=True
    ft.List(Starter.gsCmpyCode&"/MyFolder/")
    Wait For ft_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    if success then
       .......

I put break point on Wait... it never goes to next line (if success... )

I think I am missing something.

Can some one please give some clue

Thanks
What ftpserver do you use? do you have a conditional brach(else) in ListCompleted sub.
Did you try to ftp client on cmdline?
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Thanks Teddybear,
Its a shared server ftp works. There is no else statement in ListCompleted and I have no idea about cmdline.
ft.UploadFile works in same project.

B4X:
Dim sf1 As Object = ft.UploadFile(File.DirInternal&"/Myfolder/","Profile.jpg",False,sImageFilePath)
    Wait For (sf1) ft_UploadCompleted (ServerPath As String, Success As Boolean)
    If Success Then
        ToastMessageShow("Image Added Successfully.",True)
    Else
        Log("Error uploading file")
    End If
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Thanks Teddybear,
Its a shared server ftp works. There is no else statement in ListCompleted and I have no idea about cmdline.
ft.UploadFile works in same project.

B4X:
Dim sf1 As Object = ft.UploadFile(File.DirInternal&"/Myfolder/","Profile.jpg",False,sImageFilePath)
    Wait For (sf1) ft_UploadCompleted (ServerPath As String, Success As Boolean)
    If Success Then
        ToastMessageShow("Image Added Successfully.",True)
    Else
        Log("Error uploading file")
    End If
1. Add an else statement in ListCompleted, see if it is timeout or failure.
2. On the windows or linux cmd line, connect to ftpserver using ftp, run ls or dir command see if it is timeout or failure either

If it is timeout or failure,I suppose maybe the server doesn't support LIST command
 
Last edited:
Upvote 0
Top