I am trying to read a response from the server using SslStream. The server is Google IMAP and I am using the IMAP commands according to the google documentation.
The first time, when I use the AuthenticateAsClient Method, this works, and I can read the response from the server with no problems:
SslStream.Read(responseStreamBuffer, 0, responseStreamBuffer.Length);
However, when I try to use the same Read method again, I get this error: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or e stablished connection failed because connected host has failed to respond.
The rest of the code works perfectly, but after the first time reading from the stream, the code will hang out. I do have a catch
struct for handling the exception, and this is where I got the exact error from.
I essence, the server gets the command I send using the SslStream.Write
method, but every call thereafter for the Read method is rejected with the above exception.
I would be greatful for any help I can get.
Regards, Shay Rosenfeld.