iOS Question FTP PassiveMode cannot used

tzfpg

Active Member
Licensed User
Longtime User
When i using FTP PassiveMode = True, I get the error message :
B4X:
<B4IExceptionWrapper: Error Domain=caught_exception Code=0 "Error reading from stream: The operation couldn’t be completed. Can't assign requested address" UserInfo={NSLocalizedDescription=Error reading from stream: The operation couldn’t be completed. Can't assign requested address}>

If i set PassiveMode = False, I can used it but slow speed for upload or download.
But in B4A i used the same method, it work perfect didin't get any error.

Below is my coding :

B4X:
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private ftp1 As FTP
End Sub

B4X:
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    ftp1.Initialize("FTP", "xx.xx.xx.xx", 21, "testing", "testing")
    ftp1.PassiveMode = True
    ftp1.UploadFile(File.DirDocuments, "smart_home.db", False, "/SmartHomeDatabase/IOS/AppleDev-smart_home.db")
End Sub

B4X:
Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
   Log($"$Time{DateTime.Now}: ${ServerPath}, success = ${Success}"$)
  
   If Success = True Then
           Msgbox("Backup Successful", "Successful")
  Else
           Msgbox("Backup Fail", "Fail")
   End If
  
End Sub

Please help me.
 

tzfpg

Active Member
Licensed User
Longtime User
I am test in real device using local network IP is work perfect but i can't used it when i used in WAN IP.
 
Upvote 0
Top