I am facing issue "Once the socket has been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won't exit until the operation has been completed."
Below is my code:
ProxyFactory factory = new ProxyFactory();
IProxyClient proxy = factory.CreateProxy(
ProxyType.Http, uriProxy.Host, uriProxy.Port);
Socket socket = proxy.Connect(server, Imap.DefaultPort);
using (Imap imap = new Imap())
{
imap.Attach(socket);
imap.ServerCertificateValidate += Validate;
imap.ConnectSSL(server);//Port 993
imap.UseBestLogin(username, userpassword);
// ...
imap.Close();
}
Please help.