By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,704 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,704 IT Pros & Developers. It's quick & easy.

non-blocking communication with imaplib

P: n/a

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>
--
<+Kaptein-Dahigorr: for få parenteser
<+Kaptein-Dahigorr: parenteser virker som lubrication under iterasjon
<+Kaptein-Dahigorr: velkjent
Aug 22 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.