StreamWriter does throw exception underlying connection is broken?
Posted
by
Jane
on Stack Overflow
See other posts from Stack Overflow
or by Jane
Published on 2012-12-13T11:01:41Z
Indexed on
2012/12/13
11:03 UTC
Read the original article
Hit count: 200
c#
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();
© Stack Overflow or respective owner