Android Question [CLOSED] FTP download problem

edgar_ortiz

Active Member
Licensed User
Longtime User
Thanking you in advance for your time,

I can't download files using FTP.

Using CoreFTP I can connect with the credentials:
Server: hairofthedog.dreamhost.com
User: testftpsc
Password: 2020FTPtest #


Logger connected to: samsung SM-A305G
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Nothing interesting
** Activity (main) Resume **
*** Service (cargarpdf) Create ***
** Service (cargarpdf) Start **
BEGIN: RevisarPDFs
Files to Download:
000007.pdf
000006.pdf
000004.pdf
000002.pdf
000001.pdf
Downloading the File:
000007.pdf
To Folder:
/storage/emulated/0/Android/data/ftp.test/files
File 000007.pdf downloaded. Success = false
android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
Downloading the File:
000006.pdf
To Folder:
/storage/emulated/0/Android/data/ftp.test/files
File 000006.pdf downloaded. Success = false
android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
Downloading the File:
000004.pdf
To Folder:
/storage/emulated/0/Android/data/ftp.test/files
File 000004.pdf downloaded. Success = false
android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
Downloading the File:
000002.pdf
To Folder:
/storage/emulated/0/Android/data/ftp.test/files

What am I doing wrong?

Regards,

Edgar
 

Attachments

  • Test_FTP.zip
    10.8 KB · Views: 189

amykonio

Active Member
Licensed User
Longtime User
Hi.
What is the exact problem? You receive an error when you run the program?
The Net library is listed and selected in the library manager? If not you will have to download it.


Also I would put ftp initialization in a try catch block. And I would check the is
B4X:
Try
    ftp.PassiveMode = True
    ftp.Initialize("ftp", "hairofthedog.dreamhost.com", lcFtpPuerto, "testftpsc", "2020FTPtest#")
    If Not(ftp.IsInitialized) Then
        Log("Not able to initialize ftp...")
        Return
    End If
Catch
    Log(LastException)
End Try

Andreas.
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Also, you might need to add this to your manifest so non-ssl connections can be made:

B4X:
SetApplicationAttribute(android:usesCleartextTraffic, "true")
 
Upvote 0

edgar_ortiz

Active Member
Licensed User
Longtime User
Thanks for your time.

I already updated the zip of the original post.

I also tried the above recommendations and it still does NOT work, always gives the error:

android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Question, is CoreFTP an app running on the same phone as this test app?

Do you have admin access to the ftp server you are trying to download from? If so, maybe looking at the FTP logs on the server might give us a hint on what the problem is.
 
Upvote 0

edgar_ortiz

Active Member
Licensed User
Longtime User
JohnC,

Thank you

Question, is CoreFTP an app running on the same phone as this test app?

Do you have admin access to the ftp server you are trying to download from? If so, maybe looking at the FTP logs on the server might give us a hint on what the problem is.

CoreFTP runs on a PC.
I installed an FTP application from the store and it does NOT work on the phone.

the server log says: (and i have no idea what it means)

seico@hairofthedog:~/logs/seico.com.gt/http$ cat error.log
[Tue Sep 22 02:32:00.999854 2020] [cgi:error] [pid 8761:tid 4018973681408] [client 27.210.10.133:40037] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi
[Tue Sep 22 03:42:14.562513 2020] [cgi:error] [pid 8761:tid 4017807685376] [client 39.86.96.42:36069] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi
[Tue Sep 22 16:29:28.116192 2020] [cgi:error] [pid 1745:tid 4017522464512] [client 180.104.252.129:3855] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi

Regards

Edgar
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
the server log says: (and i have no idea what it means)

seico@hairofthedog:~/logs/seico.com.gt/http$ cat error.log
[Tue Sep 22 02:32:00.999854 2020] [cgi:error] [pid 8761:tid 4018973681408] [client 27.210.10.133:40037] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi
[Tue Sep 22 03:42:14.562513 2020] [cgi:error] [pid 8761:tid 4017807685376] [client 39.86.96.42:36069] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi
[Tue Sep 22 16:29:28.116192 2020] [cgi:error] [pid 1745:tid 4017522464512] [client 180.104.252.129:3855] AH02811: script not found or unable to stat: /home/seico/seico.com.gt/setup.cgi
The above error looks like a script is used to generate the server log and there is an error with the script, preventing it from displaying the actual log files.

I would contact your hosting provider to have this script error fixed, then you should be able to see the FTP logs and hopefully figure out what is going wrong.
 
Upvote 0
Top