0

Guys i'm trying to use SSLStream to test my app and so far it goes well (the client/server auth successfully), but the problem i have is reading:

How to know whether or not i have reached the end?

Microsoft's example with "EOF" simply does not work and i have tried "\r\n\r" comparison, but sometimes with long responses, it cuts out and thus i can only get a portion of the information. How can i read from this stream without knowing how long is the stream itself?

I've also tried comparing the last position of the stream with a variable that keeps the last position of the last loop and this does not work too (when you try to Read, but you've reached the end you get IOException).

4

1 回答 1

0

当没有更多数据要从流中读取时,SSLStream.Read将返回零。

请参阅:http: //msdn.microsoft.com/en-us/library/system.net.security.sslstream.read (v=vs.110).aspx

于 2013-11-12T03:47:08.407 回答