Compartir a través de


MultiplexingRelayServiceBroker.ConnectToServerAsync Method

Definition

Initializes a new instance of the MultiplexingRelayServiceBroker class and establishes a Nerdbank.Streams.MultiplexingStream protocol with the client over the given stream.

public static System.Threading.Tasks.Task<Microsoft.ServiceHub.Framework.MultiplexingRelayServiceBroker> ConnectToServerAsync (Microsoft.ServiceHub.Framework.IServiceBroker serviceBroker, System.IO.Stream duplexStreamWithClient, System.Threading.CancellationToken cancellationToken = default);
static member ConnectToServerAsync : Microsoft.ServiceHub.Framework.IServiceBroker * System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceHub.Framework.MultiplexingRelayServiceBroker>
Public Shared Function ConnectToServerAsync (serviceBroker As IServiceBroker, duplexStreamWithClient As Stream, Optional cancellationToken As CancellationToken = Nothing) As Task(Of MultiplexingRelayServiceBroker)

Parameters

serviceBroker
IServiceBroker

A broker for services to be relayed.

duplexStreamWithClient
Stream

The duplex stream over which the client will make RPC calls to the returned IRemoteServiceBroker instance. A multiplexing stream will be established on this stream and the client is expected to accept an offer for a channel with an Empty name. This object is considered "owned" by the returned MultiplexingRelayServiceBroker and will be disposed when the returned value is disposed, or disposed before this method throws.

cancellationToken
CancellationToken

A cancellation token.

Returns

A MultiplexingRelayServiceBroker that provides access to remote services, all over a multiplexing stream.

Remarks

The RemoteServiceBroker is used as the wire protocol.

Applies to