1
votes

I use IMap to read mails from gmail in c#. I have created multiple (five)TCP connections on same mailbox for faster data reading. Google allows 15 simultaneous for mailbox

https://support.google.com/mail/answer/97150?hl=en

But I am getting the error while reading data from

SslStream.Read(byte[] buffer, int offset, int count);

saying "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.".

I use following settings for your reference

imap.gmail.com port:993

Complete stack trace is as follows

: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

ERROR2015-07-10

05:46:43 – Stack Strace :: at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count) at CDT.WebMailReader.CloudMailReader.receiveResponse(ReceiveResponseParams responseParams)

I have check solution on many forums but didn't get any solution.Can some one please suggest the solution for it.

Thanks in advance

Mayuresh

1
Have you left one of your connections idle for a while?Max
No. The connection is not ideal. I am reading large mailbox and this error occurs intermittently.Mayuresh

1 Answers

-1
votes

try to use the 143 port to connect. If the problem persists, check your network environment