Android Question Problems with FTP

techgreyeye

Member
Licensed User
Longtime User
I have written a B4A app and corresponding vb.net windows application to communicate via an FTP server. I've tested this on 3 different FTP servers and all works well as expected. I signed up for hosting via a new ISP as the old one didn't allow multiple FTP accounts, and have started having problems.

When I try to get a file list (as below), Success is true, but the folders and files arrays are empty.

myftp.Initialize("myftp", cfg.address, cfg.port, cfg.username, cfg.password)
myftp.List(full_startfolder & "/to_handheld")
Wait For myftp_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)


The folders on the ftp server are:
/
data_in
15
16​
data_out
15
16​

When I try in the windows application, the stream returned from the FTP server is as I would expect when listing the root folder

.
..
data_in
data_out


but if I specify the data_in folder, the data returned is

data_in/15
data_in/16

On the other FTP servers, this would return
.
..
15
16


It seems that this FTP server is returning text data in a different format to other servers.

I tried directly send the "DIR" and "NLST" ftp commands in B4A using FTP.SendCommand, but they fail with no reply code or reply string being returned.

I'm a bit stuck as to how I make progress with this. Am I even allowed to use FTP.SendCommand like this? Is there any way of changing the parsing of the text returned from the FTP server so I can make FTP.List work? I hope someone can help


Thanks,
Darren







 
Last edited:

techgreyeye

Member
Licensed User
Longtime User
Thanks for the reply Erel.

I'd need to check with the hosting company, but it's a cheap shared hosting so I doubt I could replace the FTP server (ProFTPD).

The other thing is if once I've called myftp.List, is there anyway of accessing the raw response from the server?

Thanks again
 
Upvote 0

techgreyeye

Member
Licensed User
Longtime User
Done a bit more digging, and I think there is on option in the FTP server configuration to stop the returned filenames coming back as <folder>/<filename>, which may solve my problem.

Do you know Erel, is this likely to be the cause of the FTP.List failing to return any files or folders - this seems to make perfect sense to me.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…