c# - TCP 连接挂断但不抛出超时异常 C# (ActiveUp.Net.Mail)
问题描述
代码永远挂起,直到关闭 tcp 调用的程序并且不抛出任何异常我已经尝试重新连接每个电子邮件获取
var client = new Imap4Client();
client.SendTimeout = 180000;
client.ReceiveTimeout = 300000;
client.ConnectSsl(mailServer, port );
client.LoginFast(EmailId, password);
........
try {
Mailbox mails = client.SelectMailbox(mailBox);
int Count = mails.MessageCount;
while (Count > 0 && ControlLoop && client.IsConnected)
{
... disconnect & create new TCP email login
FlagCollection fg = mails.Fetch.Flags(Count); // timeout not working
ActiveUp.Net.Mail.Message msg = mails.Fetch.MessageObject(Count); // timeout not working
IFlagCollection newfg = fg;
mails.SetFlags(Count, newfg); // timeout not working
int getuid = mails.Fetch.Uid(Count); // timeout not working
Count--;
--- ControlLoop set true for last 6 hour data only
..... save messages in DB
}
} catch(Exception ex){
.... log error
}
```
解决方案
推荐阅读
- java - 如何在同一行代码中正确使用 instanceof 和 compareTo?
- angular - Angular 6:运行 ng test 时不加载环境
- java - BinarySearchTree 查找介于某些值之间的最接近的值
- java - 两个代码片段中哪一个更适合用于比较器?
- python - 在 dict 中找到一个值然后获取密钥
- ruby-on-rails - Rspec:如何测试重试?
- laravel - 从中间件中的响应对象获取响应正文
- python - 将烧瓶日志重定向到 Gunicorn 输出
- javascript - HTML5 背景视频无法播放
- c# - MVC Net Core 从多个页面收集数据