I'm using FTPClient
(Apache Commons Net)
I know that FTPClient
provides two methods to avoid the idle state of the FTP server:
ftpClient.setControlKeepAliveTimeout(300)
– Send a noop every five minutesftpClient.sendNoOp()
– send a noop a one-time eventI tried to use setControlKeepAliveTimeout()
But the official FTPClient document On setControlKeepAliveTimeout
....
Please note: this does not apply to the methods where the user is responsible for writing or reading the data stream, i.e.
retrieveFileStream(String)
,storeFileStream*(String)
and the otherxxxFileStream
methods
My program uses only retrieveFileStream
, which is not applied to setControlKeepAliveTimeout
.
Is there no way to operate the noop repeatedly in a stream method, not a one-time event, like a sendNoOp
?
There's nothing that will do it for you, the comment you have quoted is clear about that.
You have to code it yourself:
Read the stream and while doing that, in regular intervals, call the FTPClient.sendNoOp
.