Android Tutorial Android FTP tutorial

Status
Not open for further replies.

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Is the download successful? If yes then this error might be related to a different app.

The download is success only for the first few times, but then no more
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Can you post the relevant code?

B4X:
Sub btSrc_click
gFtp.DeleteRows

If pathDownload = "" Then
   Msgbox ("Selezionare macchina", "")
   Return
Else
   ProgressDialogShow ( "Ricerca in corso")
   FTP.List(pathDownload)
End If
End Sub

Sub ftp_ListCompleted(ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
Dim i As Int
Dim n As Int
n = 0

Dim currentFile(3) As String
If Success = False Then
    Msgbox ("Nessun file", "Errore")
    Log(LastException)
Else        
   For i = 0 To Files.Length - 1
      If (Files(i).Name.ToUpperCase.Contains (edFlt.Text.ToUpperCase.Trim)) OR (edFlt.Text = "") Then
          n = n + 1
         If n <= 100 Then
            currentFile(0) = Files(i).Name
            currentFile(1) = Files(i).Size
            currentFile(2) = DateTime.Date(Files(i).Timestamp)
            gFtp.AppendRow( currentFile )
         End If
      End If
    Next
End If
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Where is the download code?

B4X:
Sub ftp_downloadcompleted(serverpath As String, success As Boolean)
Log (serverpath & ", Success=" & success)

stringPath = File.DirRootExternal & "/" & ftpDownFileSelected

If success = False Then Msgbox (LastException.Message, "")

fileToWrite.Initialize(File.DirRootExternal & "/ProgTor", fileNameDownload, True)

If Msgbox2("Trasferire " & ftpDownFileSelected & " alla macchina?", "Conferma Invio File", "Si", "", "No", Null) = DialogResponse.POSITIVE Then            
   s1.Initialize("s1")
   s1.Connect(host, porta, timeout)
Else            
   Return
End If
End Sub


Sub s1_connected (stato As Boolean)
Dim in As InputStream
Dim out As OutputStream
Dim i As Int
Dim size, fileSize As Int

If stato = False Then
   Msgbox ( "File non trasferito", "Macchina non connessa")
   Return
End If

out = s1.OutputStream

fileSize = fileToWrite.size

Dim dadda(fileSize) As Byte
fileToWrite.ReadBytes(dadda, 0, fileSize, 0)
out.WriteBytes(dadda, 0, fileSize-1 )

If stato Then
   Msgbox("File trasferito correttamente", "")
End If

s1.Close
End Sub

s1 is a socket
 

biometrics

Active Member
Licensed User
Longtime User
FTP Resume

Has anyone solved the problem of how to resume an interrupted FTP download? If you have please post your reply to this thread.
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hi,
how can I check if a file exist in the ServerPath?
 

padvou

Active Member
Licensed User
Longtime User
Is it possible to have the filename in the following subs:
FTP_UploadProgress
FTP_UploadCompleted
 

cmartins

Member
Licensed User
Longtime User
I am tring to dowload usind 4 devices using a 50mb file. some of those devices stop the doanload and frezee. I can see in the FTP log close connection.

to try connect again only restart the device.

ftp log
[INFO ]Close connection : 10.0.50.111 - rally@navegabem.com.br
[INFO ]File download : rally@navegabem.com.br - /GOPR0114.MP4

what can I do to fix it?
 

Libertino

New Member
Licensed User
Longtime User
Do you see anything in the device log?

You should use a Service for this download:
- Call Service.StartForeground
- Acquire a partial lock with PhoneWakeState.

I'm using Net (version 1.20).
The problem is that it is compressing the spaces in the download.
Ex:
Before: 02100007PLIMOR PORTO ALEGRE
After download: 02100007PLIMOR PORTO ALEGRE

Please help me.
 

Libertino

New Member
Licensed User
Longtime User
I'm using Net (version 1.20).
The problem is that it is compressing the spaces in the download.
Ex:
Before: 02100007PLIMOR PORTO ALEGRE
After download: 02100007PLIMOR PORTO ALEGRE

Please help me.

Escuse me - the FTP is ok.
 

David Hawkins

Active Member
Licensed User
Longtime User
The problem was the path on my server !

Thanks Erel,

you are really good

:sign0188:
Hi Erel

I hope you can help me I would like to download several files at a time and whilst I have managed to achieve this it is very in-elegant and appears to download both files I have waiting twice. Can you give me a pointer to the proper way to achieve this please.

Regards

David
 

David Hawkins

Active Member
Licensed User
Longtime User
Hi Erel

I hope you can help me I am trying to download two files at the same time can you give me a pointer to the proper way to achieve this please. I have sort of succeeded but it very cumbersome and appears to download both files twice, which I am sure is not correct.

Regards

David
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…