Thanks Mark, this is exactly what I was looking for. I gave this a go,
but it didn't seem to take. I went into the code and it seems like the
SET_OPENTIMEOUT parameter isn't used by the tcp_parameters() function in
tcp_nt.c called by mail_parameters(). Is this not supported on windows
or have I perhaps just not used this correctly? Here are the commands I
issue just after calling mail_open on _mailstream:
mail_parameters(_mailstream, SET_OPENTIMEOUT, (void *)5);
mail_parameters(_mailstream, SET_READTIMEOUT, (void *)5);
mail_parameters(_mailstream, SET_WRITETIMEOUT, (void *)5);
The intent is to simply have the connection close if any of the
open/read/write commands doesn't succeed within 5 seconds.
Thanks again for your help!
Andrew
Mark Crispin wrote:
There are various timeouts that you can set. On UNIX, you can set TCP
open, TCP read, and TCP write timeouts. On Windows, you can set TCP
read and TCP write timeouts. This is done via the SET_OPENTIMEOUT,
SET_READTIMEOUT, and SET_WRITETIMEOUT functions of mail_parameters().
If you fail to arm a timeout handler via SET_TIMEOUT, a timeout will
cause an immediate disconnect. If you arm a timeout handler, then the
timeout handler is able to decide whether to disconnect or dismiss the
timeout.
Note that "disconnect or dismiss" are your only two choices; and the
only way that a c-client function will return is if it completes or
the session is disconnected. However, your timeout handler *does*
have the option of doing other tasks, (e.g., updating the screen)
prior to dismissing the timeout.
The point is that you can't return to the main thread from a timeout
without abandoning the IMAP session.
-- 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
Imap-uw@u.washington.edu
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw