Skip to content

Timeouts

Robin Rodricks edited this page Jan 22, 2023 · 9 revisions

Timeout Settings

  • ConnectTimeout - Time to wait (in milliseconds) for a connection attempt to succeed, before giving up. Default: 15000 (15 seconds).

  • ReadTimeout - Time to wait (in milliseconds) for data to be read from the FTP control stream, before giving up. Honored by all asynchronous methods as well. Default: 15000 (15 seconds).

  • DataConnectionConnectTimeout - Time to wait (in milliseconds) for an Active FTP data connection to be established, before giving up. Default: 15000 (15 seconds).

  • DataConnectionReadTimeout - Time to wait (in milliseconds) for the server to send data on the Active FTP data channel, before giving up. Does not affect data sent on the control channel or Passive FTP connections. Default: 15000 (15 seconds).

  • SocketPollInterval - Time that must pass (in milliseconds) since the last socket activity before calling Poll() on the socket to test for connectivity. Setting this interval too low will have a negative impact on performance. Setting this interval to 0 disables Polling altogether. Default: 15000 (15 seconds).

How to execute an FTP command with a different timeout?

Just set Config.ReadTimeout before calling Execute for your FTP command and then set it back to whatever you want. It should work.

client.Config.ReadTimeout = 100
client.Execute(..)
client.Config.ReadTimeout = 10000

Reason: stream.ReadLine is only called in 3 places for Execute, and all of them honor Config.ReadTimeout

image

Clone this wiki locally