Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.

Log in or register to post/reply in the forum.

Specify random sleep period before FTP upload

ChrisA Oct 22, 2017 09:04 PM

I am looking to add a random sleep of 0-120 seconds before uploading data via FTP so the 20+ loggers aren't all hammering the FTP server simultaneously. I see there is a Delay command in CRBASIC, is it possible to set the delay value to be a random number within a range?

Notso Oct 25, 2017 05:22 PM

The Delay command requires that the delay be a constant, so you cannot put a random number in the Delay instruction. But you could use a Delay inside a loop that is random. Something like this:

RealTime( rTime() )
'Seed random number generator.
'rTime(6) = Seconds
Randomize( rTime(6))
random = INT(120*RND+1)

For count = 1 To random
 Delay (0,1,Sec)
Next Count

Log in or register to post/reply in the forum.