Fork+Timeout
Josiah Carlson
jcarlson at nospam.uci.edu
Fri Mar 26 17:00:52 EST 2004
> do someone new how I can do the following?
>
> I call a method which reads from a socket. So ... this method could hang
> forever and so my call hangs too ...
>
> So ... I can not change the behavior of this Method, so I have to change my
> call.
>
> I though by forking the call to this function and set a timeout to this
> call, so my program won't hang forever.
>
> But I don't know how I should do this and if this is the correct/best way to
> do this.
Use non-blocking sockets. Check out the asyncore module, or if you are
feeling ambitious, check out Twisted.
- Josiah
More information about the Python-list
mailing list