private void Init(PipeDirection direction, PipeTransmissionMode transmissionMode, int outBufferSize) { Debug.Assert(direction >= PipeDirection.In && direction <= PipeDirection.InOut, "invalid pipe direction"); Debug.Assert(transmissionMode >= PipeTransmissionMode.Byte && transmissionMode <= PipeTransmissionMode.Message, "transmissionMode is out of range"); Debug.Assert(outBufferSize >= 0, "outBufferSize is negative"); // always defaults to this until overridden _readMode = transmissionMode; _transmissionMode = transmissionMode; _pipeDirection = direction; if ((_pipeDirection & PipeDirection.In) != 0) { _canRead = true; } if ((_pipeDirection & PipeDirection.Out) != 0) { _canWrite = true; } _outBufferSize = outBufferSize; // This should always default to true _isMessageComplete = true; _state = PipeState.WaitingToConnect; _streamAsyncHelper = new StreamAsyncHelper(this); }
public StreamFramer(Stream Transport) { if (Transport == null || Transport == Stream.Null) { throw new ArgumentNullException("Transport"); } _transport = Transport; _readHeaderBuffer = new byte[_curReadHeader.Size]; _writeHeaderBuffer = new byte[_writeHeader.Size]; _readFrameCallback = new AsyncCallback(ReadFrameCallback); _beginWriteCallback = new AsyncCallback(BeginWriteCallback); _transportAPM = new StreamAsyncHelper(_transport); }
public FixedSizeReader(Stream transport) { _transport = transport; _transportAPM = new StreamAsyncHelper(transport); }
private void InitializeStreamPart() { _ReadHeader = new byte[4]; _FrameReader = new FixedSizeReader(InnerStream); _innerStreamAPM = new StreamAsyncHelper(InnerStream); }