The default timeout value for the Wait method is 21,805,184 milliseconds, which is approximately 6 hours. The timeout value is a SIGNED LONG data type, meaning its maximum possible value is 2,147,483,647 milliseconds, which is roughly 596.5 hours or just under 25 days. This is probably enough time for even the slowest transfer.
The Wait method supports a "0" timeout value which means "keep waiting forever or until the transfer reaches a state of CANCELED, FINISHED, ERROR, SUSPENDED, SKIPPED, or BLOCKED."
You can also write scripts so that they check the condition of a transfer and if it is still in the "TRANSFERRING" state, to wait on it again.
Specify a large timeout value.
Upon timeout, check the transfer's status.
Because the first parameter to the Wait method is a task index, this example uses a "-1" which means "current task." For this example, the timeout is set for 10 hours or, 10 * 60 * 60 * 1000 = 36000000 milliseconds.
strResult = strataFTP.Wait( -1, 36000000 )
In this scenario, use the program (or script) logic to keep trying after a Wait times out, if the transfer is still in the TRANSFERRING state.
In other words, your polling for the termination status has timed out, but not necessarily the transfer itself, so you keep going.
In this example, you will wait up to 10 hours for the transfer, and if that times out, you will check the status of the transfer; if it is still TRANSFERRING, you will do it again (please note the last two conditional statements):
Do
strResult = strataFTP.Wait( -1, 36000000 )
Loop While ( strResult <> "CANCELED") and ( strResult <> "FINISHED" ) and
( strResult <> "ERROR" ) and ( strResult <> "SKIPPED" ) and
( strResult <> "SUSPENDED" ) and ( strResult <> "BLOCKED" )
Alternatively, you can take the more positive outlook that we keep going while the transfer task is either WORKING, CONNECTING, or TRANSFERRING:
Do
strResult = strataFTP.Wait( -1, 36000000 )
Loop While ( strResult = "TRANSFERRING") or ( strResult = "WORKING" ) or
( strResult = "CONNECTING" )
Most transfers eventually either FINISH or receive an error from the server but there is a minor chance that the transfer in the queue is perpetually stuck in a "TRANSFERRING" state, so this strategy might be considered a little riskier than the first two.
strResult = strataFTP.Wait( -1, 0 )