FTP1.Initialize

schimanski

Well-Known Member
Licensed User
Longtime User
I have one question about FTP-operations.

Is it enough to check once before every FTP-operation if FTP.IsInitialized is true?

It seems, that sometimes the FTP.IsInitialized is true, but it is not possible to upload or download a file. I have now in front of every FTP-operation the complete FTP.Initialize(...), but I don't know, if this is the correct way.
I only want to know, what is the best solution because my code is now full of FTP.Initialize....:signOops:

thanks...
 

schimanski

Well-Known Member
Licensed User
Longtime User
Thanks, Erel. Now I know, what I have to do.

Gesendet von meinem XT910 mit Tapatalk 2
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
There is one thing, that I can not understand.

I have now initialize the FTP-Object in Activity_Create. But when I interrupt the internet-connection and turn it on after that, FTP.Isinitialize is true, but it is not possible to make any ftp-operation. First, I have to initialize the ftp-connection again. I don't know, how to detect if I can work work with ftp or not...
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
When I interrrupt the network, I get a short toastmessage with

B4X:
libcore.io.ErrnoException: recvfrom failed: ETIMEDOUT (Connection timed out)

In the log I get

B4X:
libcore.io.ErrnoException: recvfrom failed: ETIMEDOUT (Connection timed out)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
After that, I have to initzialize the FTP once again to operate...
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Oh, sorry! My mistake...

I get two error message of the FTP_ListCompleted-Sub:

B4X:
org.apache.commons.net.ftp.FTPConnectionClosedException:
FTP response 421 received. Server closed connection.

and

libcore.io.ErnoException:sendto failed:EPIPE(Broken pipe)


When I initialize ftp in service_create, these errors are shown after a few minutes without doing any ftp-operation or when the internet-connection is closed for a short time. When I make konstant FTP-operations, the problem does not exist...

Thanks for your efforts...
 
Last edited:
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
:confused: I have tested it on different devices, and always the same. Now, it is not possible to check, if it is neccessary to initialize ftp or not. I have tried to inizialize ftp always before any ftp-operation, but this makes problems, when there are different operations at the same time...:(

Gesendet von meinem XT910 mit Tapatalk 2
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Most probably server is simply closing connection when it is inactive for some time. From what I see in the ftp tutorial, initializing ftp is NOT connecting to the server. Connection is done when an operation is requested, at least so I understood from the tutorial.
Anyway, I would firstly place all of my ftp requests in a list, then remove each one when succeeded. If failed and the error is that server closed communication, I would probably choose to close ftp, re-initialize it and restart the remaining requests. Just a thought.
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Thanks, MC73!

I think, that is a way which I could try. First, I will see, if this is a behavior of the ftp-server. Perhaps, another server doesn' make such problems....

Regards
 
Upvote 0
Top