【发布时间】:2015-04-05 09:49:21
【问题描述】:
我正在使用 TCP 客户端连接到 Gmail 帐户以阅读电子邮件。它为 TCP 连接返回 SslStream。它适用于单线程环境,但在速度方面性能非常差。
我需要优化项目以提高其速度。我已经实现了多线程,这提高了速度,但应用程序在某些时候会挂起。
使用 TCP 连接(全局成员)是否线程安全?
或者我可以创建多个 TCP 连接并传递给线程方法以提高速度吗?
或者还有其他更好的方法吗?
TCPClient m_TCPclient
SslStream sslStream;
private void createTCP()
{
// creating tcp and sslstream
}
private void authenticateUser()
{
// authenticating the user
}
private void getUserdata()
{
// iterating folders and its items
foreach(string emailID in IDList)
{
//Thread implementation
}
【问题讨论】:
标签: c# tcpclient gmail-imap sslstream