Guys i'm using SslStream as a server to test my app, but i have issues reading from the stream. I'm using the following code:
while (true)
{
int read = sslStream.Read(buffer, 0, buffer.Length);
string bufferString = System.Text.Encoding.Default.GetString(buffer);
// Check for End?
if (bufferString.IndexOf("\n\r\n", System.StringComparison.Ordinal) != -1)
{
break;
}
}
The problem is that the first loop returns:
G\0\0\0\0\0
and the second run returns:
ET /whateverman
while the result should be
GET /whateverman
What is the issue and is there a better way to read from an SslStream?