Show / Hide Table of Contents

Class TcpTransport

Inheritance
Object
TcpTransport
Implements
ITransport
IDisposable
Namespace: Libplanet.Net.Transports
Assembly: Libplanet.dll
Syntax
public class TcpTransport : object, ITransport, IDisposable

Constructors

| Improve this Doc View Source

TcpTransport(RoutingTable, PrivateKey, AppProtocolVersion, Nullable<IImmutableSet<PublicKey>>, Nullable<String>, Nullable<Int32>, IEnumerable<IceServer>, DifferentAppProtocolVersionEncountered, Int32, Nullable<TimeSpan>)

Declaration
public TcpTransport(RoutingTable table, PrivateKey privateKey, AppProtocolVersion appProtocolVersion, IImmutableSet<PublicKey>? trustedAppProtocolVersionSigners, string? host, int? listenPort, IEnumerable<IceServer> iceServers, DifferentAppProtocolVersionEncountered differentAppProtocolVersionEncountered, int minimumBroadcastTarget, TimeSpan? messageLifespan = null)
Parameters
Type Name Description
RoutingTable table
PrivateKey privateKey
AppProtocolVersion appProtocolVersion
Nullable<IImmutableSet<PublicKey>> trustedAppProtocolVersionSigners
Nullable<String> host
Nullable<Int32> listenPort
IEnumerable<IceServer> iceServers
DifferentAppProtocolVersionEncountered differentAppProtocolVersionEncountered
Int32 minimumBroadcastTarget
Nullable<TimeSpan> messageLifespan

Fields

| Improve this Doc View Source

MagicCookie

Declaration
public static readonly byte[] MagicCookie
Field Value
Type Description
Byte[]

Properties

| Improve this Doc View Source

AsPeer

Peer representation of ITransport.

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

LastMessageTimestamp

Whether this ITransport instance is running.

Declaration
public DateTimeOffset? LastMessageTimestamp { get; }
Property Value
Type Description
Nullable<DateTimeOffset>

Gets the value indicates whether the instance is running.

| Improve this Doc View Source

ProcessMessageHandler

The list of tasks invoked when a message that is not a reply is received. To handle reply, please use SendMessageWithReplyAsync(BoundPeer, Message, Nullable<TimeSpan>, CancellationToken).

Declaration
public AsyncDelegate<Message> ProcessMessageHandler { get; }
Property Value
Type Description
AsyncDelegate<Message>
| Improve this Doc View Source

Running

Declaration
public bool Running { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

BroadcastMessage(Nullable<Address>, Message)

Declaration
public void BroadcastMessage(Address? except, Message message)
Parameters
Type Name Description
Nullable<Address> except
Message message
| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

ReplyMessageAsync(Message, CancellationToken)

Declaration
public async Task ReplyMessageAsync(Message message, CancellationToken cancellationToken)
Parameters
Type Name Description
Message message
CancellationToken cancellationToken
Returns
Type Description
Task
| Improve this Doc View Source

SendMessageAsync(BoundPeer, Message, CancellationToken)

Declaration
public Task SendMessageAsync(BoundPeer peer, Message message, CancellationToken cancellationToken)
Parameters
Type Name Description
BoundPeer peer
Message message
CancellationToken cancellationToken
Returns
Type Description
Task
| Improve this Doc View Source

SendMessageWithReplyAsync(BoundPeer, Message, Nullable<TimeSpan>, CancellationToken)

Declaration
public async Task<Message> SendMessageWithReplyAsync(BoundPeer peer, Message message, TimeSpan? timeout, CancellationToken cancellationToken)
Parameters
Type Name Description
BoundPeer peer
Message message
Nullable<TimeSpan> timeout
CancellationToken cancellationToken
Returns
Type Description
Task<Message>
| Improve this Doc View Source

SendMessageWithReplyAsync(BoundPeer, Message, Nullable<TimeSpan>, Int32, Boolean, CancellationToken)

Declaration
public async Task<IEnumerable<Message>> SendMessageWithReplyAsync(BoundPeer peer, Message message, TimeSpan? timeout, int expectedResponses, bool returnWhenTimeout, CancellationToken cancellationToken = null)
Parameters
Type Name Description
BoundPeer peer
Message message
Nullable<TimeSpan> timeout
Int32 expectedResponses
Boolean returnWhenTimeout
CancellationToken cancellationToken
Returns
Type Description
Task<IEnumerable<Message>>
| Improve this Doc View Source

StartAsync(CancellationToken)

Initiates and runs transport layer.

Declaration
public async Task StartAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
CancellationToken cancellationToken

A cancellation token used to propagate notification that this operation should be canceled.

Returns
Type Description
Task

An awaitable task without value.

| Improve this Doc View Source

StopAsync(TimeSpan, CancellationToken)

Declaration
public async Task StopAsync(TimeSpan waitFor, CancellationToken cancellationToken = null)
Parameters
Type Name Description
TimeSpan waitFor
CancellationToken cancellationToken
Returns
Type Description
Task
| Improve this Doc View Source

WaitForRunningAsync()

Waits until this ITransport instance gets started to run.

Declaration
public Task WaitForRunningAsync()
Returns
Type Description
Task

A completed when Running property becomes true.

Implements

ITransport
IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2021 Planetarium