Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpMessageEncoder"/> class.
 /// </summary>
 public HttpEncoder(BufferManager bufferManager)
 {
     _bufferManager = bufferManager;
     _headerStream = new MemoryStream(_buffer);
     _headerStream.SetLength(0);
     _writer = new StreamWriter(_headerStream);
 }
Ejemplo n.º 2
0
        public SocketChannel(BufferManager bufferManager)
        {
            if (bufferManager == null) throw new ArgumentNullException("bufferManager");
            _readBuffer = bufferManager.Pop();
            _readArgs.SetBuffer(_readBuffer.Buffer, _readBuffer.Offset, _readBuffer.Capacity);
            _readArgs.Completed += OnReadCompleted;

            _writeArgs.SendPacketsFlags = TransmitFileOptions.WriteBehind;
            _writeArgs.Completed += OnWriteCompleted;
        }
Ejemplo n.º 3
0
        public BufferSlice(BufferManager bufferManager, byte[] buffer, int offset, int count)
        {
            _bufferManager = bufferManager;
            if (offset + count > buffer.Length)
                throw new ArgumentOutOfRangeException("buffer", offset + count,
                    "Offset+Count is larger than the buffer size. Buffer size: " + buffer.Length);
            if (offset < 0)
                throw new ArgumentOutOfRangeException("offset", offset, "Must be 0 or larger");
            if (count < 1)
                throw new ArgumentOutOfRangeException("count", count,
                    "At least 1 byte must be allocated for this slize.");

            Buffer = buffer;
            Offset = offset;
            Count2 = count;
            Capacity = count;
        }
Ejemplo n.º 4
0
 public HttpListener(int bufferCount)
 {
     _mgr = new BufferManager(bufferCount, 65535);
 }