You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FanDjango edited this page Jan 3, 2025
·
9 revisions
Timeout Settings
Config.ConnectTimeout - Time to wait (in milliseconds) for a connection attempt to succeed, before giving up. Default: 15000 (15 seconds).
Config.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).
Config.DataConnectionConnectTimeout - Time to wait (in milliseconds) for an Active FTP data connection to be established, before giving up. Default: 15000 (15 seconds).
Config.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).
How to execute an FTP command with a different timeout?
Just set Config.ReadTimeout before executing your FTP command and then set it back to whatever you want.
client.Config.ReadTimeout=100;// 100 ms timeoutclient.Execute(..);// execute whatever command here, you can also use high level APIclient.Config.ReadTimeout=10000;// 10 seconds timeout
Reason: stream.ReadLine is only called in 3 places for Execute, and all of them honor Config.ReadTimeout.
For a client on windows, please also read the following: