Class Ping1
Ping Protocol version 1.0
Inherited Members
Namespace: PeerTalk.Protocols
Assembly: PeerTalk.dll
Syntax
public class Ping1 : IPeerProtocol, IService
Properties
| Improve this Doc View SourceName
The name of the protocol.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String |
Swarm
Provides access to other peers.
Declaration
public Swarm Swarm { get; set; }
Property Value
Type | Description |
---|---|
Swarm |
Version
The version of the protocol.
Declaration
public SemVersion Version { get; }
Property Value
Type | Description |
---|---|
Semver.SemVersion |
Methods
| Improve this Doc View SourcePingAsync(MultiAddress, Int32, CancellationToken)
Send echo requests to a peer.
Declaration
public Task<IEnumerable<PingResult>> PingAsync(MultiAddress address, int count = 10, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
MultiAddress | address | The address of a peer to receive the echo requests. |
Int32 | count | The number of echo requests to send. Defaults to 10. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IEnumerable<PingResult>> | A task that represents the asynchronous operation. The task's value is the sequence of PingResult. |
PingAsync(MultiHash, Int32, CancellationToken)
Send echo requests to a peer.
Declaration
public Task<IEnumerable<PingResult>> PingAsync(MultiHash peerId, int count = 10, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
MultiHash | peerId | The peer ID to receive the echo requests. |
Int32 | count | The number of echo requests to send. Defaults to 10. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IEnumerable<PingResult>> | A task that represents the asynchronous operation. The task's value is the sequence of PingResult. |
ProcessMessageAsync(PeerConnection, Stream, CancellationToken)
Process a message for the protocol.
Declaration
public Task ProcessMessageAsync(PeerConnection connection, Stream stream, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
PeerConnection | connection | A connection between two peers. |
Stream | stream | The message source. |
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. |
StartAsync()
Start the service.
Declaration
public Task StartAsync()
Returns
Type | Description |
---|---|
Task |
StopAsync()
Stop the service.
Declaration
public Task StopAsync()
Returns
Type | Description |
---|---|
Task |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |