Subject: | Question on IsConnected() usage |
Date: | Mon, 30 May 2016 11:51:08 -0600 |
To: | "Phil Pearl (Lobbes) via RT" <bug-Mail-IMAPClient [...] rt.cpan.org> |
From: | Glenn Golden <gdg [...] zplane.com> |
Hi again Phil,
I've been trying to use IsConnected() as a simple means for assessing the
operational status of the client-server connection, but it doesn't seem to
behave as expected over long suspend/resume cycles. Not sure if my expectation
is wrong.
For example, I have a loop that does something like this:
place server into IDLE mode;
while (1)
{
check for traffic via idle_data() and process;
sleep a few seconds;
every 5 minutes do
{
if (IsConnected())
{
print "Still connected";
}
else
{
teardown and reconnect;
}
}
}
If the machine is suspended for several hours and then resumed, the loop
continues to hit the "still connected" clause every 5 minutes, but idle_data()
always returns 0 (never undef) forever, even though traffic due to folder
events is known to be occurring.
Is my expectation wrong on this?
In your own code, how do you go about checking for operational "workingness"?