แก้ไข

แชร์ผ่าน


NamedPipeServerStream.WaitForConnectionAsync Method

Definition

Asynchronously waits for a client to connect to this NamedPipeServerStream object.

Overloads

WaitForConnectionAsync()

Asynchronously waits for a client to connect to this NamedPipeServerStream object.

WaitForConnectionAsync(CancellationToken)

Asynchronously waits for a client to connect to this NamedPipeServerStream object and monitors cancellation requests.

WaitForConnectionAsync()

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

Asynchronously waits for a client to connect to this NamedPipeServerStream object.

public:
 System::Threading::Tasks::Task ^ WaitForConnectionAsync();
public System.Threading.Tasks.Task WaitForConnectionAsync ();
member this.WaitForConnectionAsync : unit -> System.Threading.Tasks.Task
Public Function WaitForConnectionAsync () As Task

Returns

A task that represents the asynchronous wait operation.

Remarks

Because it is asynchronous, this method returns immediately, but the connection process is completed when the client calls Connect or ConnectAsync.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WaitForConnection().

Applies to

WaitForConnectionAsync(CancellationToken)

Source:
NamedPipeServerStream.Unix.cs
Source:
NamedPipeServerStream.Unix.cs
Source:
NamedPipeServerStream.Unix.cs

Asynchronously waits for a client to connect to this NamedPipeServerStream object and monitors cancellation requests.

public:
 System::Threading::Tasks::Task ^ WaitForConnectionAsync(System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WaitForConnectionAsync (System.Threading.CancellationToken cancellationToken);
member this.WaitForConnectionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitForConnectionAsync (cancellationToken As CancellationToken) As Task

Parameters

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

A task that represents the asynchronous wait operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

Because it is asynchronous, this method returns immediately, but the connection process is completed when the client calls Connect or ConnectAsync.

Cancellation requests using the cancellation token will only work if the NamedPipeServerStream object was created with a pipe option value of PipeOptions.Asynchronous or if the cancellation occurs before the WaitForConnectionAsync method is called.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WaitForConnection().

Applies to