Class RpcHost
Namespace: DotBoxD.Services.Server
Assembly: DotBoxD.Services.dll
Accepts connections from a listener and turns each one into an DotBoxD.Services.Peer.RpcPeer. The
accept loop that used to live inside the server now lives here, and its output is peers:
because each connection is a full peer, a host can both provide services to and call back
into the peers that connect to it.
public sealed class RpcHost : IAsyncDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()
Methods
Section titled “Methods”DisposeAsync()
Section titled “ DisposeAsync()”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()Returns
Section titled “Returns”A task that represents the asynchronous dispose operation.
ForEachPeer(Action<RpcPeer>)
Section titled “ ForEachPeer(Action<RpcPeer>)”Registers configuration that runs for every accepted peer before its read loop
starts. Use it to DotBoxD.Services.Peer.RpcPeer.Provide() exports (and optionally
DotBoxD.Services.Peer.RpcPeer.Get proxies to call the peer back).
public RpcHost ForEachPeer(Action<RpcPeer> configure)Parameters
Section titled “Parameters”Returns
Section titled “Returns”Remarks
Section titled “Remarks”Services provided here are callable by any accepted peer. DotBoxD does not add authentication or authorization; enforce access control at the transport or application layer.
Listen(IServerTransport, ISerializer, RpcPeerOptions?)
Section titled “ Listen(IServerTransport, ISerializer, RpcPeerOptions?)”Creates a host that turns every accepted connection into a peer.
public static RpcHost Listen(IServerTransport listener, ISerializer serializer, RpcPeerOptions? options = null)Parameters
Section titled “Parameters”listener IServerTransport
serializer ISerializer
options RpcPeerOptions?
Returns
Section titled “Returns”StartAsync(CancellationToken)
Section titled “ StartAsync(CancellationToken)”public Task StartAsync(CancellationToken ct = default)Parameters
Section titled “Parameters”Returns
Section titled “Returns”StopAsync(CancellationToken)
Section titled “ StopAsync(CancellationToken)”public Task StopAsync(CancellationToken ct = default)Parameters
Section titled “Parameters”Returns
Section titled “Returns”AcceptError
Section titled “ AcceptError”Raised when the host accept loop catches a non-cancellation exception.
public event EventHandler<RpcHostErrorEventArgs>? AcceptErrorEvent Type
Section titled “Event Type”EventHandler<RpcHostErrorEventArgs>?
PeerConnected
Section titled “ PeerConnected”Raised after a connection is accepted and configured.
public event EventHandler<RpcPeerEventArgs>? PeerConnectedEvent Type
Section titled “Event Type”EventHandler<RpcPeerEventArgs>?
PeerDisconnected
Section titled “ PeerDisconnected”Raised when an accepted peer’s read loop ends.
public event EventHandler<RpcPeerEventArgs>? PeerDisconnected