Timeout on read()?

Peter Schneider-Kamp nowonder at nowonder.de
Thu Aug 17 09:02:24 EDT 2000


lec wrote:
> 
> Is it possible to implement timeout on read?
> 
> eg.
> 
> answer = sys.stdin.readline()
> 
> but I want it to timeout after 30 seconds.

Have a look at the select module. For an example how this
can be used for a timeout (but for socket.read()) see:
  http://www.timo-tasi.org/python/timeoutsocket.py

hope-that-helps-ly y'rs
Peter
-- 
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list