I would like to write a function in Python that triggers select() every 30 seconds.
So far my code looks like the following –
inputs = [ UDPSock , sys.stdin]
outputs = []
while inputs:
readable, writable, exceptional = select.select(inputs, outputs, inputs)
for s in readable:
if s is UDPSock
# Deal with socket
elif s is sys.stdin:
# Deal with input
I would like to achieve something along the lines of –
inputs = [ UDPSock , sys.stdin, timer]
outputs = []
while inputs:
readable, writable, exceptional = select.select(inputs, outputs, inputs)
for s in readable:
if s is UDPSock
# Deal with socket
elif s is sys.stdin:
# Deal with input
elif s is timer:
# Deal with timer
Ideally I would like to this without the use of threading if possible.
Is there a problem with using the optional
timeoutparameter to select?e.g.