Prevents loss of a IMAP server connection due to a timeout.
procedure KeepAlive;
KeepAlive is a Procedure used to prevents loss of the IMAP server connection due to a timeout condition by sending the IMAP4 NOOP command using the SendCmd method. Calling KeepAlive is allowed regardless of the value in the ConnectionState property.
Please note that the IMAP protocol states that if an IMAP server implements an autologout function, it must be of at least 30 minutes duration. To avoid being logged out, add a timer component to your form that calls the KeepAlive function every 25 minutes, but make sure you don't call KeepAlive while another IMAP function is awaiting a response, or it may mistakenly think the KeepAlive response is its response.
In practice, some IMAP servers may not implement the correct autologout duration. Also note that a dial-up connection can be disconnected after a set period of inactivity, which you may mistake for a server disconnection. If the Borland IDE debugger is active, the protocol stack sending back lower-level "keep alive" ACK packets may still result in server disconnection - if you are getting disconnected unexpectedly, try your program outside the debugger to see if the problem persists.
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved. Website http://www.indyproject.org. Post feedback to the Indy Documentation newsgroup. |