public void Dispose() { if(TcpClientStream != null) { TcpClientStream.Dispose(); TcpClientStream = null; } if(TcpClient != null) { TcpClient.Close(); TcpClient = null; } OutgoingPackets.Clear(); } }