Show / Hide Table of Contents

Class Substream

A duplex substream used by the Muxer.

Inheritance
Object
MarshalByRefObject
Stream
Substream
Implements
IDisposable
Inherited Members
Stream.Null
Stream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)
Stream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)
Stream.Close()
Stream.CopyTo(Stream)
Stream.CopyTo(Stream, Int32)
Stream.CopyToAsync(Stream)
Stream.CopyToAsync(Stream, Int32)
Stream.CopyToAsync(Stream, Int32, CancellationToken)
Stream.CreateWaitHandle()
Stream.Dispose()
Stream.EndRead(IAsyncResult)
Stream.EndWrite(IAsyncResult)
Stream.FlushAsync()
Stream.ObjectInvariant()
Stream.ReadAsync(Byte[], Int32, Int32)
Stream.ReadByte()
Stream.Synchronized(Stream)
Stream.WriteAsync(Byte[], Int32, Int32)
Stream.ReadTimeout
Stream.WriteTimeout
MarshalByRefObject.GetLifetimeService()
MarshalByRefObject.InitializeLifetimeService()
MarshalByRefObject.MemberwiseClone(Boolean)
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: PeerTalk.Multiplex
Assembly: PeerTalk.dll
Syntax
public class Substream : Stream, IDisposable
Remarks

Reading of data waits on the Muxer calling AddData(Byte[]). NoMoreData() is used to signal the end of stream.

Writing data is buffered until FlushAsync(CancellationToken) is called.

Fields

| Improve this Doc View Source

Id

The stream identifier.

Declaration
public long Id
Field Value
Type Description
Int64

The session initiator allocates odd IDs and the session receiver allocates even IDs.

| Improve this Doc View Source

Name

A name for the stream.

Declaration
public string Name
Field Value
Type Description
String

Names do not need to be unique.

| Improve this Doc View Source

SentMessageType

The type of message of sent to the other side.

Declaration
public PacketType SentMessageType
Field Value
Type Description
PacketType

Either MessageInitiator or MessageReceiver. Defaults to MessageReceiver.

Properties

| Improve this Doc View Source

CanRead

Declaration
public override bool CanRead { get; }
Property Value
Type Description
Boolean
Overrides
Stream.CanRead
| Improve this Doc View Source

CanSeek

Declaration
public override bool CanSeek { get; }
Property Value
Type Description
Boolean
Overrides
Stream.CanSeek
| Improve this Doc View Source

CanTimeout

Declaration
public override bool CanTimeout { get; }
Property Value
Type Description
Boolean
Overrides
Stream.CanTimeout
| Improve this Doc View Source

CanWrite

Declaration
public override bool CanWrite { get; }
Property Value
Type Description
Boolean
Overrides
Stream.CanWrite
| Improve this Doc View Source

Length

Declaration
public override long Length { get; }
Property Value
Type Description
Int64
Overrides
Stream.Length
| Improve this Doc View Source

Muxer

The multiplexor associated with the substream.

Declaration
public Muxer Muxer { get; set; }
Property Value
Type Description
Muxer
| Improve this Doc View Source

Position

Declaration
public override long Position { get; set; }
Property Value
Type Description
Int64
Overrides
Stream.Position

Methods

| Improve this Doc View Source

AddData(Byte[])

Add some data that should be read by the stream.

Declaration
public void AddData(byte[] data)
Parameters
Type Name Description
Byte[] data

The data to be read.

Remarks

AddData is called when the muxer receives a packet for this stream.

| Improve this Doc View Source

Dispose(Boolean)

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing
Overrides
Stream.Dispose(Boolean)
| Improve this Doc View Source

Flush()

Declaration
public override void Flush()
Overrides
Stream.Flush()
| Improve this Doc View Source

FlushAsync(CancellationToken)

Declaration
public override Task FlushAsync(CancellationToken cancel)
Parameters
Type Name Description
CancellationToken cancel
Returns
Type Description
Task
Overrides
Stream.FlushAsync(CancellationToken)
| Improve this Doc View Source

NoMoreData()

Indicates that the stream will not receive any more data.

Declaration
public void NoMoreData()
Remarks

NoMoreData is called when the muxer receives a packet to close this stream.

See Also
AddData(Byte[])
| Improve this Doc View Source

Read(Byte[], Int32, Int32)

Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type Name Description
Byte[] buffer
Int32 offset
Int32 count
Returns
Type Description
Int32
Overrides
Stream.Read(Byte[], Int32, Int32)
| Improve this Doc View Source

ReadAsync(Byte[], Int32, Int32, CancellationToken)

Declaration
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type Name Description
Byte[] buffer
Int32 offset
Int32 count
CancellationToken cancellationToken
Returns
Type Description
Task<Int32>
Overrides
Stream.ReadAsync(Byte[], Int32, Int32, CancellationToken)
| Improve this Doc View Source

Seek(Int64, SeekOrigin)

Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type Name Description
Int64 offset
SeekOrigin origin
Returns
Type Description
Int64
Overrides
Stream.Seek(Int64, SeekOrigin)
| Improve this Doc View Source

SetLength(Int64)

Declaration
public override void SetLength(long value)
Parameters
Type Name Description
Int64 value
Overrides
Stream.SetLength(Int64)
| Improve this Doc View Source

Write(Byte[], Int32, Int32)

Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type Name Description
Byte[] buffer
Int32 offset
Int32 count
Overrides
Stream.Write(Byte[], Int32, Int32)
| Improve this Doc View Source

WriteAsync(Byte[], Int32, Int32, CancellationToken)

Declaration
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type Name Description
Byte[] buffer
Int32 offset
Int32 count
CancellationToken cancellationToken
Returns
Type Description
Task
Overrides
Stream.WriteAsync(Byte[], Int32, Int32, CancellationToken)
| Improve this Doc View Source

WriteByte(Byte)

Declaration
public override void WriteByte(byte value)
Parameters
Type Name Description
Byte value
Overrides
Stream.WriteByte(Byte)

Implements

System.IDisposable

Extension Methods

StreamExtensions.ReadExactAsync(Stream, Byte[], Int32, Int32)
StreamExtensions.ReadExactAsync(Stream, Byte[], Int32, Int32, CancellationToken)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX