Struct Header
The header of a multiplex message.
Inherited Members
Namespace: PeerTalk.Multiplex
Assembly: PeerTalk.dll
Syntax
public struct HeaderRemarks
The header of a multiplex message contains the StreamId and PacketType encoded as a Varint.
Fields
| Improve this Doc View SourceMaxStreamId
The largest possible value of a StreamId.
Declaration
public const long MaxStreamId = 1152921504606846975LField Value
| Type | Description | 
|---|---|
| Int64 | long.MaxValue >> 3. | 
MinStreamId
The smallest possible value of a StreamId.
Declaration
public const long MinStreamId = 0LField Value
| Type | Description | 
|---|---|
| Int64 | Zero. | 
PacketType
The purpose of the multiplex message.
Declaration
public PacketType PacketTypeField Value
| Type | Description | 
|---|---|
| PacketType | One of the PacketType enumeration values. | 
StreamId
The stream identifier.
Declaration
public long StreamIdField Value
| Type | Description | 
|---|---|
| Int64 | The session initiator allocates odd IDs and the session receiver allocates even IDs. | 
Methods
| Improve this Doc View SourceReadAsync(Stream, CancellationToken)
Reads the header from the specified Stream.
Declaration
public static Task<Header> ReadAsync(Stream stream, CancellationToken cancel = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Stream | stream | The source Stream for the header. | 
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. | 
Returns
| Type | Description | 
|---|---|
| Task<Header> | A task that represents the asynchronous operation. The task's result is the decoded Header. | 
WriteAsync(Stream, CancellationToken)
Writes the header to the specified Stream.
Declaration
public Task WriteAsync(Stream stream, CancellationToken cancel = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Stream | stream | The destination Stream for the header. | 
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. | 
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the asynchronous operation. |