0 votes
by (750 points)

Can I use KeepAlive in Imap object ??

MailMessage objMailMessage = ObjImapClient.GetMessage(v.UniqueId);

In the above line I get error as "Server has closed the connection" to avoid this I think I need to tell my imap server that please keepalive while transfer so is there any way I can do this???

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (58.9k points)
edited by

When the IMAP server closes the connection during the GetMessage method, it means that the server has closed the connection while sending the data of the message to the client. Server obviously knows that the message data are being sent by it. And thus the server does not close the connection for a prolonged inactivity, but for some other - from the point of Rebex IMAP unknown - server reason.

There is something similar to FTP KeepAlive method, in Rebex IMAP the method is called CheckForUpdates and it sends a NOOP command (and returns whether there were any updates/ changes). See more details.

Actually, the KeepAlive option or KeepAlive method of the Rebex FTP client is meant to prevent an inactive control connection in the FTP protocol from being closed by the server, or by firewalls while the download is in progress (because the data flow through the other "data" connection in FTP protocol ).

Unlike FTP, the IMAP protocol from its nature only uses one connection so during the ongoing download of a mail message through IMAP, there are data flowing all the time through the connection, so it cannot become inactive and thus sending a NOOP command to the server would not make any difference! That is why we do not offer this funcionality in Rebex IMAP.

By the way does the problem demonstrate itself only for a certain message, or for any message on the IMAP server?

We advice you to turn to the admins of the problematic IMAP server if they can check why the server is closing the connection.