StreamWriter does throw exception underlying connection is broken?
- by Jane
I am using StreamWriter instantiated over a Tcpstream
like this
streamWriter = new StreamWriter(tcpClient.GetStream());
I am confused about the behaviour of following calls with regards to Exceptions. The following two functions are expected to raise IOException , Surprisingly they do not raise the IOException when the server is to which the tcpClient is connected is disconnected and therefore the underlying TCP client connection is broken.. These two lines execute without raising any Exception. Why ?
streamWriter.WriteLine(strBuffer);
streamWriter.Flush();