Better way to read in stream data without wrapping the whole thing in an empty try catch?
<p>Doing something like this at the moment:</p>

<pre><code>try
{
    while ((bytesRead = clientStream.Read(data, 0, data.Length)) != 0)
    {
        string message = Encoding.ASCII.GetString(data, 0, bytesRead) + Environment.NewLine;

        txtLog.Invoke(c =&gt; c.AppendText(message));
    }
}
catch
{

}
</code></pre>

<p>Which works but it's pretty ugly.</p>

<p>I know people are going to say not to catch all exceptions and to at least do something when an exception occurs but I'm writing a server application. If a user abruptly disconnections it doesn't matter. It doesn't need to be logged. Also, I never want the program to crash so is catching all exceptions really that bad? The program can still recover. After the while loop this code executes and everything is fine. Right?:</p>

<pre><code>string clientIdentifier = tcpClient.Client.RemoteEndPoint.ToString();

bool clientRemoved = clients.TryRemove(clientIdentifier);

if (clientRemoved)
{
    listUsers.Invoke(c =&gt; c.Items.Remove(clientIdentifier));
}

tcpClient.Close();
</code></pre>

<p>Not really asking a specific question but more of wondering if this is fine and if not, what is a better way to handle a user abruptly disconnecting or any other form of read error?</p>
