Hi
I have a question whether the NET library currently works. I have a strange situation - I tried to connect to 3 different FTP servers and none of them downloaded the file. I don't know if I'm doing everything right. Here is my sample code:
You can connect normally using WinSCP
Manifest file:
I have a question whether the NET library currently works. I have a strange situation - I tried to connect to 3 different FTP servers and none of them downloaded the file. I don't know if I'm doing everything right. Here is my sample code:
code:
Sub Process_Globals
Dim FTP As FTP
'Dim rp As RuntimePermissions
End Sub
Sub Globals
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
Dim s As String
s = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then
Log(LastException.Message)
End If
End Sub
Sub Button1_Click
FTP.Initialize("FTP", "ftp.cpc.ncep.noaa.gov", 21, "anonymous", "")
Log("Results:" & FTP.IsInitialized)
FTP.PassiveMode=True
If FTP.IsInitialized Then
FTP.DownloadFile("/wd52dg/data/indices/tele_index_nh", True, File.DirRootExternal, "111.txt")
'FTP.DownloadFile("wd52dg/data/indices/tele_index_nh", True, File.DirRootExternal, "111.txt")
End If
End Sub
You can connect normally using WinSCP
Manifest file:
manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)