示例#1
0
        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}).");
            }
        }
示例#2
0
 private void CreateNewInputBuffer()
 {
     _inputStream  = new CommunicationStream();
     _packetReader = new NetworkPacketReader(_inputStream);
 }
示例#3
0
 protected virtual void OnConnectionSent(CommunicationStream stream)
 {
 }