Ejemplo n.º 1
0
        public void Send(byte[] buffer, int offset, int count)
        {
            var client = _client;

            if (client == null)
            {
                throw new InvalidOperationException("Channel closed");
            }

            try
            {
                var args = _sendArgsPool.GetObject();
                args.SetBuffer(buffer, offset, count);

                if (!client.SendAsync(args))
                {
                    OnSendCompleted(client, args);
                }
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }