By default, asynchronous operations started by methods (such as
BeginPutFile) never time out and the value of
Timeout property doesn't affect them. But when the
TimeoutAsynchronousMethods option is enabled, they time out just like synchronous methods (such as
When an asynchronous method times out, an
FtpExceptionStatus.Timeout is thrown. This is similar to other kind of errors. The asynchronous operations ends immediately, which means the callback gets called. The exception is thrown as soon as you can the
End* method (such as
Please note that the
Timeout value doesn't specify the maximum time allowed for the whole operation. Instead, the operation times out when no response has been received for the specified amount of time.
You can specify multiple options, but you have to use bitwise | instead of &:
// Set client options
client.Options = Rebex.Net.FtpOptions.TimeoutAsynchronousMethods |
& operator would be equivalent to
client.Options = 0; and no flags would be set. For detailed explanation, check out this link.