Reputation: 742
I used MailKit.Net.Imap to read email in my mail box.
Sometimes I get an exception like that I shared below
System.IO.IOException: Connection timed out ---> System.Net.Sockets.SocketException (110): Connection timed out at MailKit.Net.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) --- End of inner exception stack trace ---
Is there any suggistion to solve this problem?
ImapClient client;
client = new ImapClient();
client.Timeout= (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
Also, I can use timeout property of Imap, this can help me to solve this problem?
Upvotes: 0
Views: 1224
Reputation: 38538
You have 2 options:
ImapClient.Timeout
property. (That said, 1 minute is less than the default timeout which is 2 minutes)ImapClient
).Upvotes: 1