B4A Library New Net library - Android FTP, SMTP and POP3

Status
Not open for further replies.

biometrics

Active Member
Licensed User
Longtime User

Martin,

Has NetExtas been updated to match the latest Net library?
 

warwound

Expert
Licensed User
Longtime User
Martin,

Has NetExtas been updated to match the latest Net library?

See here: http://www.b4x.com/android/forum/threads/lib-netextras.26902/#post-231566.
I updated NetExtras to match version 1.51 of the Net library - Erel kindly sent me the Net library version 1.51 source code.
I was waiting for you to reply to my post in the NetExtras thread, since then the Net library has been updated again.

Can i ask Erel to send me the source code for the latest version of the Net library and i'll again update NetExtras?

Thanks.

Martin.
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

I'm trying our the new library for FTPS explicit mode. I assume I need to use the new property to enable it?

B4X:
libFTP.UseSSLExplicit = True

I am getting the following error though:

(CertPathValidatorException) java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

Do I need to set libFTP.SetCustomSSLTrustManager to something?

It's the same sample I sent you on 14 March but the login is different. Can I email it to you to try?

I can confirm it works with other software like FileZilla client on Windows for example.
 
Last edited:

biometrics

Active Member
Licensed User
Longtime User
Erel,

Not to worry. A bit of searching led me to the new object CustomTrustManager.
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

Got an interesting problem that I managed to do a workaround for ...

On the Samsung Galaxy Tab 3 when downloading large files (> 150 MB) with FTP the DownloadCompleted event does not fire when the file has been downloaded. It does fire correctly on small files (< 1 MB) and on other devices. DownloadProgress does fire though.

I worked around this by monitoring the DownloadProgress event. When the local and remote files are the same size I set a 10 second timer. If DownloadCompleted fires I disable the timer. If DownloadCompleted doesn't fire then my timer fires. At that point I restart the whole FTP process (it resumes).

The only gotcha was that I had to Dim the FTP library again before the Initialize (or else it wouldn't connect again). I have it declared in Process_Globals. I saw you mention in another thread that you had to Dim it again (which is counter to what I would have expected coming from VB6).

I'm using the Net and NetExtras 1.52 libraries with SSL explicit.
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

When I run it in debug mode then the DownloadProgress event does not fire often and it appears to hang at the end. So I have to run it in release mode. I clicked Connect in the Log window and this is the result (no errors and no DownloadCompleted event):

B4X:
LogCat connected to: B4A-Bridge: samsung GT-P5200-357359055991177
--------- beginning of /dev/log/main
Failure getting entry for 0x01080a03 (t=7 e=2563) in package 0 (error -75)
Parent view is not a TextView
Failure getting entry for 0x01080a03 (t=7 e=2563) in package 0 (error -75)
Failure getting entry for 0x01080a03 (t=7 e=2563) in package 0 (error -75)
loaded /vendor/lib/egl/libEGL_POWERVR_SGX544_115.so
loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX544_115.so
loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX544_115.so
Enabling debug mode 0
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Setting install_non_market_apps has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
** Service (service1) Create **
Rejecting registerization due to mul-int/lit8 v4, v2, (#31)
Rejecting registerization due to mul-int/lit8 v4, v2, (#31)
** Service (service1) Start **
Total arena pages for JIT: 11
Total arena pages for JIT: 12
Total arena pages for JIT: 13
Total arena pages for JIT: 14
Total arena pages for JIT: 15
Total arena pages for JIT: 16
Total arena pages for JIT: 17
Total arena pages for JIT: 18
Total arena pages for JIT: 19
Total arena pages for JIT: 20
Connected to B4A-Bridge (Wifi)
Rejecting registerization due to and-int/lit16 v0, v5, (#128)
Rejecting registerization due to and-int/lit16 v0, v5, (#128)
Installing file.
Rejecting registerization due to move v5, v4, (#0)
GC_CONCURRENT freed 2610K, 41% free 6189K/10380K, paused 2ms+1ms, total 54ms
Rejecting registerization due to move v5, v4, (#0)
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:isenzo.clientele.ifa
** Activity (main) Resume **
Setting install_non_market_apps has moved from android.provider.Settings.Secure to android.provider.Settings.Global.

The Samsung Galaxy Tab 3.0 10.1 has a Intel Atom Z2560, not ARM. Don't know if that would make a difference.
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

It's in the Net library. I tested it without NetExtras and it does the same thing.
 

biometrics

Active Member
Licensed User
Longtime User
No I have the following active:

B4X:
libPhoneWakeState.KeepAlive(True)
libPhoneWakeState.PartialLock
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I did a test with this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim ps As PhoneWakeState
   ps.KeepAlive(True)
   FTP.Initialize("ftp", "xxx", 21, "aaa", "bbb")
   FTP.DownloadFile("/xxx", False, File.DirRootExternal, "1.dat")
End Sub

Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
   Log(NumberFormat2(TotalDownloaded, 0, 0, 0, True))
End Sub

Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
   Log(ServerPath & " " & Success)
End Sub
It successfully downloaded a 163MB file. DownloadCompleted fired at the end. I ran it in rapid debug mode.
 

biometrics

Active Member
Licensed User
Longtime User
As mentioned it works on other devices and also with smaller files on this device. It's specific to the Samsung Galaxy Tab 3 10.1. I have no idea why it doesn't fire but at least my workaround works. I'd obviously prefer if it worked the way it should but in the mean time we can ship the product.
 

biometrics

Active Member
Licensed User
Longtime User
It is not possible to set a proxy server with this library.

Hi Erel,

Is that because of the underlying libraries limitations or is it possible to add it? If it is possible to add it we can contract Martin/warwound to add it to his Net Extras as he did for us with the Download Resume (if he is available). We'll happily pay him for that work.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…