public void Dispose() { if (client != null) { client.Disconnect(); client.Dispose(); client = null; } }