/// <summary>
/// Closes the stream and optionally closes the underlying <see cref="SecureSocket"/>.
/// </summary>
/// <remarks>
/// The Close method frees resources used by the SecureNetworkStream instance and, if the SecureNetworkStream owns the underlying socket, closes the underlying socket.
/// </remarks>
public override void Close()
{
if (m_OwnsSocket)
{
try {
Socket.Shutdown(SocketShutdown.Both);
} catch {
} finally {
Socket.Close();
}
}
}