Android Tutorial Android FTP tutorial

Status
Not open for further replies.

androh

Member
Licensed User
Longtime User
How do you see that it is still running?

FTP_UploadProgress sub is running and updating progressbar in panel.
In device, network notification icon is blinking.
In ftp server, file size is growing.
I'm using Net library V1.2
 

androh

Member
Licensed User
Longtime User
I see it now. The data stream is not closed when you call CloseNow.

Please try the updated library attached.
It should close the data connection on the first time UploadProgress event fires (after calling CloseNow).

Thanks a lot. Now it's working :sign0060:
 

mujeeb74

Member
Licensed User
Longtime User
I have a problem when make upload for any file using NET Libraries.
I got a file size as 0KB in ftp server, Do I need to close ftp connection to complete uploading file.
 

Evadman

Member
Licensed User
Longtime User
I have a problem when make upload for any file using NET Libraries.
I got a file size as 0KB in ftp server, Do I need to close ftp connection to complete uploading file.

I had that problem when using the emulator, and when I ran the same code on a phone, I did not have that problem.
 

margret

Well-Known Member
Licensed User
Longtime User
I have an issue using B4A 2.02 and the FTP net lib. I am writing a Class for FTP that I will share once I am done. All works fine so far but the Total in FTP_DownloadProgress always returns -1. I want to update a ProgressBar with the download but the Total is missing. I saw in the first post of this thread the code used is If Total > 0 Then. Is this an item that is returned from some servers and not others, etc. The TotalDownloaded is fine, it's just the Total that always returns -1.

B4X:
Private Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
    PB2.Visible = True
   PB2.BringToFront
   PB2.Progress = (100 / Total) * (TotalDownloaded)
End Sub
 
Last edited:

mc73

Well-Known Member
Licensed User
Longtime User

Without knowing the exact cause, I would suspect it is something similar to what we often see while downloading from some servers using our pc-based browsers, where the total size of the download is not shown (shows a 'unknown' time left). So I would guess that -1 is some sort of response error.
 

mc73

Well-Known Member
Licensed User
Longtime User
Idont know how can i add the .jar file needed pelase publish an examplee

Grab both xml and jar files of the library and place them in the 'libraries' folder of your b4a installation folder. Then when in the b4a ide, look at the right panel, choose libs, and then select the desired library.
 

louisproy123

Member
Licensed User
Longtime User
HI Carlos..... I am also interested in the FTP solution ... did you finally get it to work ?

Thanks
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hi,
using library, I've got this log error:

(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)

What's wrong? :BangHead:
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
While I'm working, doing the same things, I get that error on the log.

(ErrnoException) libcore.io.ErrnoException: sendto failed: ECONNRESET (Connection reset by peer)
(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)(ErrnoException) libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
.......................

and the list go on with the same error
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Are you using a real device? On mobile network or wifi?

Have you tried changing to passive mode?

Yes, I'm using a real device with wifi. I also changed to passive mode, but nothing
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
This error hints to some network problem.

When does this error happen? Is the download successful?

This error happen when I download. But not at the first time, after about 5 minutes that I don't use the tablet
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…