N
Nad
Hello All,
I have been trying to get some sort of documantion on how
StreamReader.ReadToEnd() finds out if the stream has ended and if
anyone can read the following lines and tell me how to control
indefinite blocking issue. these are from MSDN.
"ReadToEnd assumes that the stream knows when it has reached an end.
For interactive protocols, in which the server sends data only when
you ask for it and does not close the connection, ReadToEnd might
block indefinitely and should be avoided."
I have code that reads from the NetworkStream and loads it into the
string builder. here is the code
NetworkStream stream = (NetworkStream)connector.Execute(cp);
StreamReader sr = new StreamReader(stream);
StringBuilder sbuilder = new StringBuilder();
sbuilder.Append( sr.ReadToEnd());
Now, the code will freeze if the response is not complete. How can I
use this code and what changes I will need to make to avoid that
indefinite blocking issue with ReadToEnd() .
help is appriciated.
I have been trying to get some sort of documantion on how
StreamReader.ReadToEnd() finds out if the stream has ended and if
anyone can read the following lines and tell me how to control
indefinite blocking issue. these are from MSDN.
"ReadToEnd assumes that the stream knows when it has reached an end.
For interactive protocols, in which the server sends data only when
you ask for it and does not close the connection, ReadToEnd might
block indefinitely and should be avoided."
I have code that reads from the NetworkStream and loads it into the
string builder. here is the code
NetworkStream stream = (NetworkStream)connector.Execute(cp);
StreamReader sr = new StreamReader(stream);
StringBuilder sbuilder = new StringBuilder();
sbuilder.Append( sr.ReadToEnd());
Now, the code will freeze if the response is not complete. How can I
use this code and what changes I will need to make to avoid that
indefinite blocking issue with ReadToEnd() .
help is appriciated.