J
Jon Skeet [C# MVP]
Lou said:I am using the StreamReader to read data from a network pipe.
these function hang
sr.peek()
sr.readAll()
sr.read()
when there is no more data in the pipe.
sr.ReadLine works because there are CR's.
Is this because there is no null character in the pipe to signal the EOF?
You don't get a "null character" to signal an end of stream on a socket
connection - you just get a closed socket.
What do I call to see if the pipe is empty?
How do I get all the data from the pipe?
Example reads all the character then hangs when there is no more data.
nChar never returns -1, it just hangs...
You need to make the other end of the connection close it.