The SetIdleTimeout method changes the idle timeout
period for the control connection, which can be useful in scenarios
where a file transfer session is expected to remain idle for
extended periods between commands. For example, when transferring
large batches of files or performing periodic synchronization,
the server may automatically close the connection if no activity
is detected within its default timeout period. Increasing the idle
timeout helps prevent unexpected disconnects during these idle
periods, reducing the need to repeatedly reconnect and re-authenticate.
Conversely, reducing the timeout can be used to enforce shorter
sessions in security-sensitive environments.
The SITE IDLE command is a non-standard extension
to the FTP protocol that allows a client to query or set the server's
idle timeout period for the current session. When supported, it
enables the client to request how long the server should wait during
periods of inactivity before automatically closing the connection.
This setting does not affect the duration of data transfers, only
how long the control session is kept open when idle.
Because SITE IDLE is not part of the official FTP
specification, support for it varies between servers. If the command
is not supported, the method will fail but the session will remain
connected using the server's default timeout settings. The method
will also return an error if a negative timeout value is specified
or if the session is using SFTP, which does not support this operation.