We have been uploading files successfully with FTP for a good while. Recently, we've been running into problems occasionally. I updated the code to display the exact error to users and we've seen this error several times: "500 Illegal Port Command" (see error image attached to this post).
Below are the two code snippets that connect and download. I think they're in order.
Here's my question: Is the error likely the result of a bad WiFi/Internet connection? Or could it be that the FTP functions are issuing a command that is not accepted by the server?
Since the process succeeds most of the time, I'm guessing it's a connection problem despite the fact that we've confirmed WiFi and connected to the server. Could it be something else?
I'd appreciate any knowledge you may have.
- Don
Connect:
Upload:
Below are the two code snippets that connect and download. I think they're in order.
Here's my question: Is the error likely the result of a bad WiFi/Internet connection? Or could it be that the FTP functions are issuing a command that is not accepted by the server?
Since the process succeeds most of the time, I'm guessing it's a connection problem despite the fact that we've confirmed WiFi and connected to the server. Could it be something else?
I'd appreciate any knowledge you may have.
- Don
Connect:
B4X:
Socket1.Initialize("Socket1")
Socket1.Connect( Main.config.Get( "FTPServer" ), Main.config.Get( "FTPPort" ), 5000 )
btnUpload.visible = True
btnCancel.visible = True
If FTP.isInitialized = False Then
FTP.Initialize( "FTP", Main.config.Get( "FTPServer" ), Main.config.Get( "FTPPort" ), Main.config.Get( "FTPUsername" ), Main.config.Get( "FTPPassword" ) )
Log("initializing FTP")
End If
Upload:
B4X:
Dim sf As Object = FTP.UploadFile( File.DirDefaultExternal, tfilename, False, tfilename )
wait for (sf) FTP_UploadCompleted( serverpath As String, success As Boolean )
If success = False Then
Log(LastException.Message)
MessageDialog.Show( "Error During Upload", LastException.Message, "Ok", "", "", 0, 0, .8 )
MessageDialog.Show( "Upload Not Completed", "Please try again another time", "Ok", "", "", 0, 0, .8 )
Activity.Finish
Else
File.Delete( File.DirDefaultExternal, tfilename )
pbx.Progress = 100
If file_number = file_list.Size Then
MessageDialog.Show( "Upload Complete", "Data has been uploaded to CFRF", "Ok", "", "", 0, 0, .8 )
Activity.Finish
StartActivity(DownloadODDUpdate)
Else
DoThisUpload( file_list.Get(file_number) )
End If
End If