public async Task ConnectAsync(string ip, ushort port) { if (Connected) { throw new ProtocolException("Connection error: Already connected to server."); } await _stream.ConnectAsync(ip, port); if (_readTask != null && _readTask.Status == TaskStatus.Running) { throw new ProtocolException("Connection error: Task already running."); } else { _readTask = Task.Factory.StartNew(ReadCycle); } }