P
Pif Paf
I have a process, and my process wants to wait for input but only for
a certain amount of time. The input might be coming from a Python file
object (created with popen) or a TCP socket.
What I want is something like:
s = getTimedInput(source, maxDelay)
where:
source = the source of the input
maxDelay = the maximum amount of time we're going to wait for input,
in milliseconds. We wait this amount of time, or a shorter time if we
receive a "\n"(1) in the character stream
s = a string containing the input that was received
(1): or whatever delimiter character we're using.
a certain amount of time. The input might be coming from a Python file
object (created with popen) or a TCP socket.
What I want is something like:
s = getTimedInput(source, maxDelay)
where:
source = the source of the input
maxDelay = the maximum amount of time we're going to wait for input,
in milliseconds. We wait this amount of time, or a shorter time if we
receive a "\n"(1) in the character stream
s = a string containing the input that was received
(1): or whatever delimiter character we're using.