Interface INetworkDiscovery
Defines the contract for network discovery services.
Namespace: Morpheo.Sdk
Assembly: Morpheo.Sdk.dll
Syntax
public interface INetworkDiscovery
Methods
| Edit this page View SourceGetPeers()
Retrieves the list of currently known peers.
Declaration
IReadOnlyList<PeerInfo> GetPeers()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<PeerInfo> | A read-only list of peers. |
StartAdvertisingAsync(PeerInfo, CancellationToken)
Starts broadcasting presence (Hello packets) in the background. This method should not block execution.
Declaration
Task StartAdvertisingAsync(PeerInfo myInfo, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| PeerInfo | myInfo | The local peer information. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
StartListeningAsync(CancellationToken)
Starts listening for incoming packets in the background. This method should not block execution.
Declaration
Task StartListeningAsync(CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Stop()
Stops the discovery service and releases resources (sockets).
Declaration
void Stop()
Events
| Edit this page View SourcePeerFound
Event triggered when a new peer is found.
Declaration
event EventHandler<PeerInfo> PeerFound
Event Type
| Type | Description |
|---|---|
| EventHandler<PeerInfo> |
PeerLost
Event triggered when a peer is lost.
Declaration
event EventHandler<PeerInfo> PeerLost
Event Type
| Type | Description |
|---|---|
| EventHandler<PeerInfo> |