I
Igor V. Rafienko
Hi,
I was wondering if anyone had a suggestion for the following issue. 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].
Is there another option for detecting when the server fails to reply
within a given time slot? Could I perhaps temporarily set the socket
to non-blocking mode? Or maybe I am attacking this problem the wrong
way altogether?
Any hints would be greatly appreciated.
TIA,
ivr
[1] <http://docs.python.org/lib/socket-objects.html#l2h-3693>
I was wondering if anyone had a suggestion for the following issue. 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].
Is there another option for detecting when the server fails to reply
within a given time slot? Could I perhaps temporarily set the socket
to non-blocking mode? Or maybe I am attacking this problem the wrong
way altogether?
Any hints would be greatly appreciated.
TIA,
ivr
[1] <http://docs.python.org/lib/socket-objects.html#l2h-3693>