コード例 #1
0
        public async Task SendAsync(OutgoingMessage message, CancellationToken cancellationToken)
        {
            var encoder = _encoderFactory.Create(message);
            var bytes   = encoder.Encode(message);
            await _byteStream.WriteAsync(new byte[] { message.ToNodeId }, 0, 1, cancellationToken);

            await _byteStream.WriteAsync(bytes, 0, bytes.Length, cancellationToken);

            await _byteStream.WriteAsync(new byte[] { 0x0D, 0x0A }, 0, 2, cancellationToken);
        }