In message <[EMAIL PROTECTED]>, Igor V. Rafienko wrote:

> I would like to talk to an IMAP-server, imaplib being the tool of
> choice, of course. Unfortunately it may happen that the IMAP-server
> fails to respond to certain commands, and I would like to be able to
> detect that within a given time period (on the scale of 5-10 seconds).
> 
> Initially, I thought about playing with setsockblocking() for the
> communication socket in the imaplib.IMAP4 object. However, the IMAP4
> object uses a file object ("created from" the said socket), and the
> underlying socket must be blocking according to [1].
>
> [1] <http://docs.python.org/lib/socket-objects.html#l2h-3693>

According to the documentation
<http://docs.python.org/lib/imap4-objects.html>, you can override
the "read" and "readline" methods. How about replacing them with routines
that use select.select on the socket() object to implement a timeout?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to