AK.F1.Timing.Server.Proxy.ProxySession.SendAsync C# (CSharp) Метод

SendAsync() публичный Метод

Begins an asynchronous operation to send the specified buffers.
/// Thrown when is . /// /// Thrown when the this instance has been disposed of. ///
public SendAsync ( IEnumerable buffers ) : void
buffers IEnumerable The buffers to send.
Результат void
        public void SendAsync(IEnumerable<byte[]> buffers)
        {
            CheckDisposed();
            Guard.NotNull(buffers, "buffers");

            foreach(var buffer in buffers)
            {
                _bufferQueue.Enqueue(new ByteBufferSnapshot(buffer, 0, buffer.Length));
            }
            SendNextBufferIfNotBusy();
        }

Same methods

ProxySession::SendAsync ( ByteBufferSnapshot buffer ) : void

Usage Example

Пример #1
0
        public void can_send_a_buffer()
        {
            using(var ctx = new TestContext())
            using(var session = new ProxySession(0, ctx.Output))
            {
                var expected = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

                session.SendAsync(new[] { expected });

                var actual = new byte[expected.Length];
                Assert.Equal(ctx.Input.Receive(actual), expected.Length);
                Assert.Equal(expected, actual);
                Assert.False(ctx.Input.Poll(PollTimeout, SelectMode.SelectRead));
            }
        }
All Usage Examples Of AK.F1.Timing.Server.Proxy.ProxySession::SendAsync