I have connection with POP3 server
CODE
TcpClient client;
SslStream stream;
void Connect()
{
client = new TcpClient();
client.Connect("pop.gmail.com", 995);
stream = new SslStream(client.GetStream());
stream.AuthenticateAsClient("pop.gmail.com");
}
ReadMessages()
{
Connect()
//getting the message
int length = stream.Read(readBuffer, 0, readBuffer.Length);
message = Encoding.ASCII.GetString(readBuffer, 0, length);
//Handle the incoming messages from the server
}
Then at some some moment i close the stream and the TcpClient and after some time i call the ReadMessages() method again.But this exception occured when i connect to the server and try to read the incoming data - "The Read method cannot be called when another read operation is pending.".What's wrong?I have closed the stream and client before initialize the new instances,what's that pending read operation?
This post has been edited by cygnusX: 6 Apr, 2008 - 10:26 PM