protected virtual void OnConnectionReceived(CommunicationStream stream) { try { if (!_connection || !_connection.Established || _connection.Terminated) { return; } _inputStream.SetLength(0); _inputStream.Position = Connection.PacketLengthPos; stream.CopyTo(_inputStream); _inputStream.Position = 0; _packetReader.PreparePacket(); } catch (Exception e) { OnConnectionError($"Protocol.OnConnectionReceived: Failed to prepare packet ({e.Message})."); } }
private void CreateNewInputBuffer() { _inputStream = new CommunicationStream(); _packetReader = new NetworkPacketReader(_inputStream); }
protected virtual void OnConnectionSent(CommunicationStream stream) { }