On Thu, 10 Aug 2006, Jean-Francois Ducarroz wrote:
I open the connection using mail_open, do couple IMAP operations like
fetching new mail. Everything goes well as expected.
I am done for know but I keep the IMAP connection open for performance
purpose. 30 seconds later, I execute a another IMAP command but the
connection did drop since last time I used it therefore the command failed!
That seems difficult to believe. Do you really mean 30 seconds, or do you
mean 30 minutes?
30 minutes is the normal autologout time for an inactive IMAP session;
it's also the specification-defined minimum inactivity autologout time.
So, an inactive session should last for at least 30 minutes.
NAT tends to make the time lower, particularly if the server initiates
traffic without client action (IDLE command). UW imapd normally does not
initiate such traffic, and the c-client library does not support the IDLE
command, so this is normally not an issue with UW imapd and c-client.
Another issue you should consider is that with traditional UNIX mailbox
format (the default in UW imapd), you can only have one session open on
the mailbox at a time. If you open a second session to the same mailbox,
the first one is automatically killed. So, your client should avoid
opening multiple sessions to the same mailbox; this is good practice even
if the IMAP server uses another mailbox format that permits multiple
access.
Personally, I would like to be able to detect if my connection is still alive
before executing any IMAP command, if it's not open, I can try to open it
first.
You can't do it. The way to test the session is to do something with it.
The simplest solution to that problem is to always call mail_open before
doing anything rather than "holding" the stream but this solution as
performance issue.
That's not a solution.
Call mail_ping() on the session every 60-150 seconds to keep the session
alive. Don't spawn multiple sessions to the same mailbox. If you still
get unexpected connection closing, then there is some problem that bears
investigation.
-- Mark --
http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw