I have a client on an Android app which, on command, sends files to an ftp server on a pc built in B4J
The server on the pc is always active
If I start the Android app and try to send everything works correctly
After a few minutes that the app is waiting, if I start the same command to send files to the ftp server, the command fails From log B4A it appears:
Error uploading file - android.system.ErrnoException: sendto failed: EPIPE (Broken pipe) or
Error uploading file - java.net.SocketTimeoutException
What can I check to eliminate the disconnection problem after a few minutes?
(B4A 10.70 + jdk-11.0.1, Win 10 pro 64bit, B4J 9.10 + jdk-11.0.1)
The server on the pc is always active
If I start the Android app and try to send everything works correctly
After a few minutes that the app is waiting, if I start the same command to send files to the ftp server, the command fails From log B4A it appears:
Error uploading file - android.system.ErrnoException: sendto failed: EPIPE (Broken pipe) or
Error uploading file - java.net.SocketTimeoutException
What can I check to eliminate the disconnection problem after a few minutes?
(B4A 10.70 + jdk-11.0.1, Win 10 pro 64bit, B4J 9.10 + jdk-11.0.1)
CODE FOR B4J SERVER:
Masterdir = "C:\FTP"
server.Initialize(Me, "FTPServer")
server.SetPorts(Ftp_Control_Port, Ftp_Data_Port1, Ftp_Data_Port2)
server.AddUser(Utente, Password,Dir_utente)
server.ForcedServerIp = ""
server.BaseDir = Masterdir
server.Start
CODE FOR B4A CLIENT:
Sub Process_Globals
Dim FtpCli As FTP
End Sub
Public Sub Inizializza
FtpCli.Initialize("FtpCliEvent", Main.ftp_server_ip,Main.ftp_server_port,Main.ftp_user,Main.ftp_password)
FtpCli.PassiveMode = True
FtpCli.UseSSL = False
FtpCli.UseSSLExplicit = False
End Sub
Sub FtpUploadFile(dir_file_da_inviare As String, file_da_inviare As String)
Dim sf As Object = FtpCli.UploadFile(dir_file_da_inviare, file_da_inviare, True, "/" & file_da_inviare)
Wait For (sf) FtpCliEvent_UploadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log("File was uploaded successfully -> " & file_da_inviare)
Else
Log("Error uploading file - " & LastException.Message)
End If
End Sub
Sub FtpCliEvent_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
Dim s As String= "UP " & ServerPath & " " & Round(TotalUploaded / 1000) & "KB "
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub FtpCliEvent_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub
Last edited: