DataFlex
DataFlex
Sleep for a Number of Milliseconds (FTP Utility)
See more FTP Examples
Demonstrates the Chilkat Ftp2.SleepMs method, which blocks the calling thread for a number of milliseconds. The only argument is the millisecond count. It performs no FTP network operation.
Background: This is a plain convenience wrapper around a thread sleep, provided so scripts and generated examples can pause without pulling in a language-specific timing API. Typical uses are inserting a short delay between polling attempts, or giving a finicky server a moment between operations. It does nothing FTP-specific.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoFtp
Integer iMillisec
String sTemp1
Move False To iSuccess
// Demonstrates the Ftp2.SleepMs method, which blocks the calling thread for a number of
// milliseconds. The only argument is the number of milliseconds. It performs no FTP network
// operation.
Get Create (RefClass(cComChilkatFtp2)) To hoFtp
If (Not(IsComObjectCreated(hoFtp))) Begin
Send CreateComObject of hoFtp
End
Set ComHostname Of hoFtp To "ftp.example.com"
Set ComUsername Of hoFtp To "myFtpLogin"
// Normally you would not hard-code the password in source. You should instead obtain it
// from an interactive prompt, environment variable, or a secrets vault.
Set ComPassword Of hoFtp To "myPassword"
Get ComConnect Of hoFtp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
// A small pause can be useful when polling or when a server needs a moment between operations.
Move 500 To iMillisec
Send ComSleepMs To hoFtp iMillisec
Showln "Waited half a second."
Get ComDisconnect Of hoFtp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure