Please pardon my C#.Net newbie status. If this is obvious and I missed it from the docs, a link to the relevant page or sample code would be appreciated.
I am workin
When you are reading streaming data you need some sentinel/terminating character or a known size of the data to determine when to stop reading and process the information. Null characters or newlines are common. Another technique is using a fixed size header which specifies the length of the body.
The socket will remain open until you close it or the other side terminates, in which case you will get an error while reading from the socket, which you shuold handle. NetworkStream throws an IOException when the socket has been closed from the remote side during a read or write operation.