Ejemplo n.º 1
0
        public MessageChannel(IMessageTransport xport, IMessageFormat format)
        {
            _xport = xport;
            _format = format;
            _buffer = new List<byte>();
            _nextSeq = 1;

            _xport.DataReady += OnDataReady;
            _xport.ConnectionClosed += OnConnectionClosed;
        }
Ejemplo n.º 2
0
        public MessageReader(IChunkReader chunkReader, int defaultBufferSize, int maxBufferSize, ILogger logger,
                             IMessageFormat messageFormat)
        {
            Throw.ArgumentNullException.IfNull(chunkReader, nameof(chunkReader));
            Throw.ArgumentNullException.IfNull(messageFormat, nameof(messageFormat));

            _logger            = logger;
            _chunkReader       = chunkReader;
            _defaultBufferSize = defaultBufferSize;
            _maxBufferSize     = maxBufferSize;
            _bufferStream      = new MemoryStream(_defaultBufferSize);
            _packStreamReader  = messageFormat.CreateReader(_bufferStream);
        }
Ejemplo n.º 3
0
 public MessageReader(Stream stream, int defaultBufferSize, int maxBufferSize, ILogger logger, IMessageFormat messageFormat)
     : this(new ChunkReader(stream, logger), defaultBufferSize, maxBufferSize, logger, messageFormat)
 {
 }
Ejemplo n.º 4
0
 public MessageReader(Stream stream, IMessageFormat messageFormat)
     : this(stream, Constants.DefaultReadBufferSize, Constants.MaxReadBufferSize, null, messageFormat)
 {
 }
Ejemplo n.º 5
0
        public MessageWriter(Stream stream, int defaultBufferSize, int maxBufferSize, IDriverLogger logger, IMessageFormat messageFormat)
        {
            Throw.ArgumentNullException.IfNull(stream, nameof(stream));
            Throw.ArgumentOutOfRangeException.IfFalse(stream.CanWrite, nameof(stream));
            Throw.ArgumentNullException.IfNull(messageFormat, nameof(messageFormat));

            _chunkWriter      = new ChunkWriter(stream, defaultBufferSize, maxBufferSize, logger);
            _packStreamWriter = messageFormat.CreateWriter(_chunkWriter.ChunkerStream);
        }
Ejemplo n.º 6
0
 public MessageWriter(Stream stream, int defaultBufferSize, int maxBufferSize, IMessageFormat messageFormat)
     : this(stream, defaultBufferSize, maxBufferSize, null, messageFormat)
 {
 }
Ejemplo n.º 7
0
 public MessageWriter(Stream stream, IMessageFormat messageFormat)
     : this(stream, Constants.DefaultWriteBufferSize, Constants.MaxWriteBufferSize, messageFormat)
 {
 }