public virtual void Shutdown()
{
_socket.Disconnect(false);
_socket.Close();
}
/// <summary> /// Terminates the network connection and stops the message handling loop. /// </summary> public void Disconnect() { lock (this) { _running = false; try { // This is the correct way to stop an IO bound loop if (_conn != null) { _conn.Shutdown(); } } catch (IOException) { // Don't care about this. } } }