예제 #1
0
 internal sealed override async Task ReadFromCoreAsync(ReadBuffer readBuffer, CancellationToken cancellationToken)
 {
     await base.ReadFromCoreAsync(readBuffer, cancellationToken);
     await readBuffer.FillAsync(3, cancellationToken);
     this.GetPacketFlagsDtdAndAppBytesLength(readBuffer);
     await readBuffer.FillAsync(
         this.applicationBytes, 0, this.applicationBytes.Length, cancellationToken);
 }
        internal sealed override async Task ReadFromCoreAsync(ReadBuffer readBuffer, CancellationToken cancellationToken)
        {
            await base.ReadFromCoreAsync(readBuffer, cancellationToken);

            await readBuffer.FillAsync(3, cancellationToken);

            this.GetPacketFlagsDtdAndAppBytesLength(readBuffer);
            await readBuffer.FillAsync(
                this.applicationBytes, 0, this.applicationBytes.Length, cancellationToken);
        }
예제 #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal static async Task <S101Message> ReadFromAsync(
            ReadBuffer readBuffer, CancellationToken cancellationToken)
        {
            if (!await readBuffer.ReadAsync(cancellationToken))
            {
                return(null);
            }

            var         slot = readBuffer[readBuffer.Index++];
            byte        messageType;
            S101Command command;

            try
            {
                await readBuffer.FillAsync(1, cancellationToken);

                messageType = GetMessageType(readBuffer);
                command     = await S101Command.ReadFromAsync(readBuffer, cancellationToken);
            }
            catch (EndOfStreamException ex)
            {
                throw new S101Exception("Unexpected end of stream.", ex);
            }

            return(new S101Message(slot, messageType, command));
        }
예제 #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal static async Task<S101Message> ReadFromAsync(
            ReadBuffer readBuffer, CancellationToken cancellationToken)
        {
            if (!await readBuffer.ReadAsync(cancellationToken))
            {
                return null;
            }

            var slot = readBuffer[readBuffer.Index++];
            byte messageType;
            S101Command command;

            try
            {
                await readBuffer.FillAsync(1, cancellationToken);
                messageType = GetMessageType(readBuffer);
                command = await S101Command.ReadFromAsync(readBuffer, cancellationToken);
            }
            catch (EndOfStreamException ex)
            {
                throw new S101Exception("Unexpected end of stream.", ex);
            }

            return new S101Message(slot, messageType, command);
        }
예제 #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal static async Task <S101Command> ReadFromAsync(ReadBuffer readBuffer, CancellationToken cancellationToken)
        {
            await readBuffer.FillAsync(2, cancellationToken);

            var result = GetCommandAndVersion(readBuffer);
            await result.ReadFromCoreAsync(readBuffer, cancellationToken);

            return(result);
        }
예제 #6
0
        internal sealed override async Task ReadFromCoreAsync(
            ReadBuffer readBuffer, CancellationToken cancellationToken)
        {
            await base.ReadFromCoreAsync(readBuffer, cancellationToken);

            await readBuffer.FillAsync(1, cancellationToken);

            this.IsActive = readBuffer[readBuffer.Index++] > 0;
        }