I am developing a server-based data acquisition application. I want the server to read data from file (to simulate real data stream) every 0.01 second. Every it reads a chunk of data from the file. So I am using a generator to read data by chunks. Then I am think about using some sort of timer to control how often to the generator returns data. I have tried the RepeatedTimer mentioned in this post, but it didn't work. Any help on this?
Just a simple generator for your information.
def generator():
count = 0
while True:
count = count + 1
yield count
The RepeatedTimer module is mentioned here (the 3rd answer): Run certain code every n seconds
This is how I called the RepeatedTimer. When running the code, there was no response.
count = RepeatedTimer(0.01, generator)
print count