I made an example FTP server and client to try sending files on my local pc, but I have problems. Can anyone help me understand where the error is.
thank you
thank you
server side:
Sub AppStart (Args() As String)
server.Initialize(Me, "FTPServer")
server.SetPorts(51041, 51042, 51142)
server.AddUser("Test", "test")
'server.AddUser("anonymous", "") 'anonymous access
'server.ForcedServerIp = "127.0.0.1" 'local access
server.BaseDir = "c:\temp\ftp"
server.Start
server.ForcedServerIp = "127.0.0.1"
StartMessageLoop
End Sub
Sub FTPServer_StateChanged
Log($"Number of clients: ${server.NumberOfClients}"$)
End Sub
client SIDE:
Private Sub startftp
mFtp.Initialize("", "127.0.0.1" , 51041, "Test", "test")
'mFtp.Initialize("", "ftp.anse2000.it" , 21, "c1422", "c1422nI4ta2")
Log( "isinizialized " & mFtp.IsInitialized)
'Dim sf_send As Object = mFtp.SendCommand("MKD", "/somefolder/newfolder")
'"C:\B4J\works\B4JAnse2000\Objects\folderFiles"
Dim sf As Object = mFtp.UploadFile(File.DirApp, "c1422_ordfor.zip", False, "/c1422_ordfor.zip")
Log("start upload ")
Wait For (sf) ftp_UploadCompleted (ServerPath As String, Success As Boolean)
Log("ServerPath = " & ServerPath)
If Success Then
Log("file was uploaded successfully")
Else
Log("Error uploading file")
End If
mFtp.Close
End Sub
isinizialized true
start upload
java.lang.RuntimeException: Error uploading file.
500 Unknown command: PORT
at anywheresoftware.b4a.net.FTPWrapper$2.run(FTPWrapper.java:241)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)