示例#1
0
 public static async Task SendAsync(this ITransportChannel channel, Stream content, long length)
 {
     if (!await channel.TrySendAsync(content, length).ConfigureAwait(false))
     {
         throw new OperationCanceledException();
     }
 }
示例#2
0
 public static async Task SendMessageAsync(
     this ITransportChannel channel,
     byte[] buffer,
     int offset,
     int count)
 {
     using (var stream = new MemoryStream(buffer, offset, count))
     {
         await channel.TrySendAsync(stream, count).ConfigureAwait(false);
     }
 }