Hi, I think I've found a problem in the FTP net library version 1.52.
I use SSL (explicit) with a FileZilla Server to make a connection with a self-signed certificate with this code:
Sub Activity_Create(FirstTime As Boolean)
Effetipi.Initialize("Effetipi", "10.10.10.54",21, "user", "pwd")
CTM.InitializeAcceptAll
Effetipi.SetCustomSSLTrustManager(CTM)
Effetipi.PassiveMode = True
Effetipi.UseSSL=False
Effetipi.UseSSLExplicit=True
Log(Effetipi.IsInitialized)
Effetipi.SendCommand("PWD","")
End Sub
Sub Effetipi_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
Effetipi.CloseNow()
Msgbox("finito","")
End Sub
When using closenow...
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:908)
at org.apache.commons.net.SocketClient.closeQuietly(SocketClient.java:309)
at org.apache.commons.net.SocketClient.disconnect(SocketClient.java:298)
at org.apache.commons.net.ftp.FTP.disconnect(FTP.java:434)
at org.apache.commons.net.ftp.FTPClient.disconnect(FTPClient.java:843)
at anywheresoftware.b4a.net.FTPWrapper.CloseNow(FTPWrapper.java:434)
at com.palmosoft.primaprova.main._effetipi_commandcompleted(main.java:377)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
The problem occurred on the line with closenow but only in release or debug legacy (works in debug rapid!) and only with this manifest directive:
android:targetSdkVersion="14"
If you remove the targetSdkVersion directive or debug in rapid mode this problem vanishes.
Attached the project.
Maurizio
I use SSL (explicit) with a FileZilla Server to make a connection with a self-signed certificate with this code:
Sub Activity_Create(FirstTime As Boolean)
Effetipi.Initialize("Effetipi", "10.10.10.54",21, "user", "pwd")
CTM.InitializeAcceptAll
Effetipi.SetCustomSSLTrustManager(CTM)
Effetipi.PassiveMode = True
Effetipi.UseSSL=False
Effetipi.UseSSLExplicit=True
Log(Effetipi.IsInitialized)
Effetipi.SendCommand("PWD","")
End Sub
Sub Effetipi_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
Effetipi.CloseNow()
Msgbox("finito","")
End Sub
When using closenow...
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:908)
at org.apache.commons.net.SocketClient.closeQuietly(SocketClient.java:309)
at org.apache.commons.net.SocketClient.disconnect(SocketClient.java:298)
at org.apache.commons.net.ftp.FTP.disconnect(FTP.java:434)
at org.apache.commons.net.ftp.FTPClient.disconnect(FTPClient.java:843)
at anywheresoftware.b4a.net.FTPWrapper.CloseNow(FTPWrapper.java:434)
at com.palmosoft.primaprova.main._effetipi_commandcompleted(main.java:377)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
The problem occurred on the line with closenow but only in release or debug legacy (works in debug rapid!) and only with this manifest directive:
android:targetSdkVersion="14"
If you remove the targetSdkVersion directive or debug in rapid mode this problem vanishes.
Attached the project.
Maurizio