コード例 #1
0
        public async Task pingAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            await OutputProtocol.WriteMessageBeginAsync(new TMessage("ping", TMessageType.Call, SeqId), cancellationToken);

            var args = new pingArgs();

            await args.WriteAsync(OutputProtocol, cancellationToken);

            await OutputProtocol.WriteMessageEndAsync(cancellationToken);

            await OutputProtocol.Transport.FlushAsync(cancellationToken);

            var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

            if (msg.Type == TMessageType.Exception)
            {
                var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                throw x;
            }

            var result = new pingResult();
            await result.ReadAsync(InputProtocol, cancellationToken);

            await InputProtocol.ReadMessageEndAsync(cancellationToken);

            return;
        }