Share via


ServerFactory.CreateAsync Method

Definition

Caution

Use Create instead.

Creates a named pipe server.

[System.Obsolete("Use Create instead.")]
public static System.Threading.Tasks.Task<(IDisposable Server, string ServerName)> CreateAsync (string pipeName, System.Diagnostics.TraceSource? logger, Func<System.IO.Stream,System.Threading.Tasks.Task> onConnectedCallback);
[<System.Obsolete("Use Create instead.")>]
static member CreateAsync : string * System.Diagnostics.TraceSource * Func<System.IO.Stream, System.Threading.Tasks.Task> -> System.Threading.Tasks.Task<ValueTuple<IDisposable, string>>
Public Shared Function CreateAsync (pipeName As String, logger As TraceSource, onConnectedCallback As Func(Of Stream, Task)) As Task(Of ValueTuple(Of IDisposable, String))

Parameters

pipeName
String

The name of the server. Typically just the result of calling ToString() on the result of NewGuid(). This should not include path separators.

logger
TraceSource

The logger for the server.

onConnectedCallback
Func<Stream,Task>

Callback function to be run whenever a client connects to the server. This may be called concurrently if multiple clients connect. The delegate may choose to return right away while still using the Stream or to complete only after finishing communication with the client.

Returns

A tuple where Server is disposable to shut down the pipe, and ServerName is the pipe name as the client will need to access it. It implements IAsyncDisposable. ServerName will typically be the same as pipeName on Windows, but on mac/linux it will have a path prepended to it.

Attributes

Applies to