[
https://issues.apache.org/jira/browse/NET-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997371#comment-12997371
]
Sebb commented on NET-258:
--------------------------
I think there are two alternate approaches which don't require much rework.
These only apply to GET and PUT operations, which AFAICT are the main (only?)
issue here.
1) add a Listener to the copyStream() method call, and use it to send a NOOP if
sufficient time has elapsed since the last NOOP or the start of the GET/PUT.
This will operate in the same thread as the transfer, so won't have
thread-safety issues. It might perhaps slow down the transfer briefly, though
generally the limiting factor will be the network, and the total network
traffic will be the same as if the NOOP were in a separate thread. The
advantage is that this will work for all versions of Java (even ones with
broken readLine() implementations). The disadvantage is that the gaps between
calls to the listener are not in general predictable.
2) Use a separate thread which handles the NOOP. This would only work on Java
1.6+. The thread needs to be carefully synch. with the GET/PUT operation, so
needs to be done as part of (e.g.) the retrieveFile() method, which can disable
the NOOP sending as soon as the file transfer has ended.
In both cases it is possible for the last NOOP request/response to overlap with
the 226 response, so this needs to be allowed for.
> Implement A Keepalive Mechanism
> -------------------------------
>
> Key: NET-258
> URL: https://issues.apache.org/jira/browse/NET-258
> Project: Commons Net
> Issue Type: Improvement
> Affects Versions: 2.0
> Reporter: Rory Winston
> Assignee: Rory Winston
> Attachments: ftp-keepalive.diff
>
>
> For routers/firewalls that terminate idle connections, a separate heartbeat
> mechanism may need to be implemented to keep the control connection active.
> Some potential issues:
> * Synchronization between a heartbeat write and a __getReply() on an active
> control connection command;
> * Should use the NOOP command as a heartbeat signal;
> * Make the timeout configurable;
> * Default SocketImpl::setKeepAlive() wont do here.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira